change names to names that better describe what it does
This commit is contained in:
parent
d65e4fefc1
commit
2e752c2a2e
6
mouse.h
6
mouse.h
|
@ -28,9 +28,9 @@ static const Button buttons[] = {
|
||||||
{ ClkClientWin, MODIFIER1, Button2, togglefloating, {0} },
|
{ ClkClientWin, MODIFIER1, Button2, togglefloating, {0} },
|
||||||
{ ClkClientWin, MODIFIER1|ControlMask, Button3, dragcfact, {0} },
|
{ ClkClientWin, MODIFIER1|ControlMask, Button3, dragcfact, {0} },
|
||||||
{ ClkClientWin, MODIFIER1, Button3, dragmfact, {0} },
|
{ ClkClientWin, MODIFIER1, Button3, dragmfact, {0} },
|
||||||
{ ClkStatusText, 0, Button1, spawn, {.v = statuscmd } },
|
{ ClkStatusText, 0, Button1, spawn, {.v = clickstatus } },
|
||||||
{ ClkStatusText, 0, Button2, spawn, {.v = statuscmd } },
|
{ ClkStatusText, 0, Button2, spawn, {.v = clickstatus } },
|
||||||
{ ClkStatusText, 0, Button3, spawn, {.v = statuscmd } },
|
{ ClkStatusText, 0, Button3, spawn, {.v = clickstatus } },
|
||||||
{ ClkWinTitle, 0, Button1, togglewin, {0} },
|
{ ClkWinTitle, 0, Button1, togglewin, {0} },
|
||||||
{ ClkWinTitle, 0, Button3, spawn, cmd( "speedwm-utils" ) },
|
{ ClkWinTitle, 0, Button3, spawn, cmd( "speedwm-utils" ) },
|
||||||
{ ClkRootWin, 0, Button3, spawn, cmd( "j4-dmenu-desktop --term=st --dmenu='dmenu -l 20 -p Open:'" ) },
|
{ ClkRootWin, 0, Button3, spawn, cmd( "j4-dmenu-desktop --term=st --dmenu='dmenu -l 20 -p Open:'" ) },
|
||||||
|
|
28
speedwm.c
28
speedwm.c
|
@ -385,7 +385,7 @@ struct Systray {
|
||||||
typedef struct {
|
typedef struct {
|
||||||
const char *cmd;
|
const char *cmd;
|
||||||
int id;
|
int id;
|
||||||
} StatusCmd;
|
} ClickStatus;
|
||||||
|
|
||||||
/* Xresources preferences */
|
/* Xresources preferences */
|
||||||
enum resource_type {
|
enum resource_type {
|
||||||
|
@ -785,7 +785,7 @@ static int statusw;
|
||||||
|
|
||||||
/* clickability */
|
/* clickability */
|
||||||
#if USEMOUSE
|
#if USEMOUSE
|
||||||
static int statuscmdn;
|
static int clickstatusn;
|
||||||
static char lastbutton[] = "-";
|
static char lastbutton[] = "-";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -944,7 +944,7 @@ static xcb_connection_t *xcon;
|
||||||
#define RCMD(cmd) {.v = (const char*[]){ shell, "-c", cmd, NULL } },
|
#define RCMD(cmd) {.v = (const char*[]){ shell, "-c", cmd, NULL } },
|
||||||
#define cmd( cmd ) {.v = (const char*[]){ shell, "-c", cmd, NULL } },
|
#define cmd( cmd ) {.v = (const char*[]){ shell, "-c", cmd, NULL } },
|
||||||
|
|
||||||
static const char *statuscmd[] = { "/bin/sh", "-c", NULL, NULL }; /* for running click scripts */
|
static const char *clickstatus[] = { "/bin/sh", "-c", NULL, NULL }; /* for running click scripts */
|
||||||
|
|
||||||
/* Media controls */
|
/* Media controls */
|
||||||
#if USEMEDIA
|
#if USEMEDIA
|
||||||
|
@ -971,7 +971,7 @@ static int systraypinningfailfirst = 1;
|
||||||
/* Mouse support */
|
/* Mouse support */
|
||||||
#if USEMOUSE
|
#if USEMOUSE
|
||||||
#include "mouse.h" /* Include mouse support */
|
#include "mouse.h" /* Include mouse support */
|
||||||
#include "statusbar.h" /* Include mouse statuscmd support */
|
#include "statusbar.h" /* Include mouse clickstatus support */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* IPC support */
|
/* IPC support */
|
||||||
|
@ -1436,7 +1436,7 @@ buttonpress(XEvent *e)
|
||||||
char *text = rawstext;
|
char *text = rawstext;
|
||||||
int i = -1;
|
int i = -1;
|
||||||
char ch;
|
char ch;
|
||||||
statuscmdn = 0;
|
clickstatusn = 0;
|
||||||
while (text[++i]) {
|
while (text[++i]) {
|
||||||
if ((unsigned char)text[i] < ' ') {
|
if ((unsigned char)text[i] < ' ') {
|
||||||
ch = text[i];
|
ch = text[i];
|
||||||
|
@ -1447,8 +1447,8 @@ buttonpress(XEvent *e)
|
||||||
i = -1;
|
i = -1;
|
||||||
if (x >= ev->x)
|
if (x >= ev->x)
|
||||||
break;
|
break;
|
||||||
if (ch <= LENGTH(statuscmds))
|
if (ch <= LENGTH(clickstatuss))
|
||||||
statuscmdn = ch;
|
clickstatusn = ch;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (!selmon->hideunselectedtitle) {
|
} else if (!selmon->hideunselectedtitle) {
|
||||||
|
@ -2528,7 +2528,7 @@ if(!selmon->hidesystray && m == systraytomon(m) && !systrayposition)
|
||||||
resizebarwin(m);
|
resizebarwin(m);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* for statuscmd */
|
/* for clickstatus */
|
||||||
for (text = s = stext; *s; s++) {
|
for (text = s = stext; *s; s++) {
|
||||||
if ((unsigned char)(*s) < ' ') {
|
if ((unsigned char)(*s) < ' ') {
|
||||||
ch = *s;
|
ch = *s;
|
||||||
|
@ -5967,16 +5967,16 @@ spawn(const Arg *arg)
|
||||||
if (dpy)
|
if (dpy)
|
||||||
close(ConnectionNumber(dpy));
|
close(ConnectionNumber(dpy));
|
||||||
#if USEMOUSE
|
#if USEMOUSE
|
||||||
if (arg->v == statuscmd) {
|
if (arg->v == clickstatus) {
|
||||||
for (int i = 0; i < LENGTH(statuscmds); i++) {
|
for (int i = 0; i < LENGTH(clickstatuss); i++) {
|
||||||
if (statuscmdn == statuscmds[i].id) {
|
if (clickstatusn == clickstatuss[i].id) {
|
||||||
statuscmd[2] = statuscmds[i].cmd;
|
clickstatus[2] = clickstatuss[i].cmd;
|
||||||
|
|
||||||
/* compatibility with dwm bars */
|
/* compatibility with dwm bars */
|
||||||
setenv("BUTTON", lastbutton, 1);
|
setenv("BUTTON", lastbutton, 1);
|
||||||
int writestatus = fputs(lastbutton, buttonfile);
|
int writestatus = fputs(lastbutton, buttonfile);
|
||||||
if (writestatus == EOF) {
|
if (writestatus == EOF) {
|
||||||
fprintf(stderr, "speedwm: failed to write statuscmd button.\n");
|
fprintf(stderr, "speedwm: failed to write clickstatus button.\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5985,7 +5985,7 @@ spawn(const Arg *arg)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!statuscmd[2])
|
if (!clickstatus[2])
|
||||||
exit(EXIT_SUCCESS);
|
exit(EXIT_SUCCESS);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
2
status.h
2
status.h
|
@ -5,7 +5,7 @@
|
||||||
*
|
*
|
||||||
* This separate program (status.c, status.h) is licensed under the GNU General Public License version 2.0.
|
* This separate program (status.c, status.h) is licensed under the GNU General Public License version 2.0.
|
||||||
*
|
*
|
||||||
* Prefix: Text that will be printed before each module. This can be Pango/status2d/statuscmd markup or a unicode/ASCII character.
|
* Prefix: Text that will be printed before each module. This can be Pango/status2d/clickstatus markup or a unicode/ASCII character.
|
||||||
* Command: Command that will run. The output of this command will be printed for that module.
|
* Command: Command that will run. The output of this command will be printed for that module.
|
||||||
* Update interval: How often the module will be updated in seconds.
|
* Update interval: How often the module will be updated in seconds.
|
||||||
* Update signal: What signal reloads the module with force. (using the kill command)
|
* Update signal: What signal reloads the module with force. (using the kill command)
|
||||||
|
|
|
@ -18,8 +18,10 @@
|
||||||
* 2 - Middle click
|
* 2 - Middle click
|
||||||
* 3 - Right click
|
* 3 - Right click
|
||||||
*
|
*
|
||||||
|
* See https://dwm.suckless.org/patches/statuscmd for more information.
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
static const StatusCmd statuscmds[] = {
|
static const ClickStatus clickstatuss[] = {
|
||||||
{ "module_time --click", 1 },
|
{ "module_time --click", 1 },
|
||||||
{ "module_date --click", 2 },
|
{ "module_date --click", 2 },
|
||||||
{ "module_bat --click", 3 },
|
{ "module_bat --click", 3 },
|
||||||
|
|
Loading…
Reference in a new issue