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|ControlMask, Button3, dragcfact, {0} },
|
||||
{ ClkClientWin, MODIFIER1, Button3, dragmfact, {0} },
|
||||
{ ClkStatusText, 0, Button1, spawn, {.v = statuscmd } },
|
||||
{ ClkStatusText, 0, Button2, spawn, {.v = statuscmd } },
|
||||
{ ClkStatusText, 0, Button3, spawn, {.v = statuscmd } },
|
||||
{ ClkStatusText, 0, Button1, spawn, {.v = clickstatus } },
|
||||
{ ClkStatusText, 0, Button2, spawn, {.v = clickstatus } },
|
||||
{ ClkStatusText, 0, Button3, spawn, {.v = clickstatus } },
|
||||
{ ClkWinTitle, 0, Button1, togglewin, {0} },
|
||||
{ ClkWinTitle, 0, Button3, spawn, cmd( "speedwm-utils" ) },
|
||||
{ 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 {
|
||||
const char *cmd;
|
||||
int id;
|
||||
} StatusCmd;
|
||||
} ClickStatus;
|
||||
|
||||
/* Xresources preferences */
|
||||
enum resource_type {
|
||||
|
@ -785,7 +785,7 @@ static int statusw;
|
|||
|
||||
/* clickability */
|
||||
#if USEMOUSE
|
||||
static int statuscmdn;
|
||||
static int clickstatusn;
|
||||
static char lastbutton[] = "-";
|
||||
#endif
|
||||
|
||||
|
@ -944,7 +944,7 @@ static xcb_connection_t *xcon;
|
|||
#define RCMD(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 */
|
||||
#if USEMEDIA
|
||||
|
@ -971,7 +971,7 @@ static int systraypinningfailfirst = 1;
|
|||
/* Mouse support */
|
||||
#if USEMOUSE
|
||||
#include "mouse.h" /* Include mouse support */
|
||||
#include "statusbar.h" /* Include mouse statuscmd support */
|
||||
#include "statusbar.h" /* Include mouse clickstatus support */
|
||||
#endif
|
||||
|
||||
/* IPC support */
|
||||
|
@ -1436,7 +1436,7 @@ buttonpress(XEvent *e)
|
|||
char *text = rawstext;
|
||||
int i = -1;
|
||||
char ch;
|
||||
statuscmdn = 0;
|
||||
clickstatusn = 0;
|
||||
while (text[++i]) {
|
||||
if ((unsigned char)text[i] < ' ') {
|
||||
ch = text[i];
|
||||
|
@ -1447,8 +1447,8 @@ buttonpress(XEvent *e)
|
|||
i = -1;
|
||||
if (x >= ev->x)
|
||||
break;
|
||||
if (ch <= LENGTH(statuscmds))
|
||||
statuscmdn = ch;
|
||||
if (ch <= LENGTH(clickstatuss))
|
||||
clickstatusn = ch;
|
||||
}
|
||||
}
|
||||
} else if (!selmon->hideunselectedtitle) {
|
||||
|
@ -2528,7 +2528,7 @@ if(!selmon->hidesystray && m == systraytomon(m) && !systrayposition)
|
|||
resizebarwin(m);
|
||||
#endif
|
||||
|
||||
/* for statuscmd */
|
||||
/* for clickstatus */
|
||||
for (text = s = stext; *s; s++) {
|
||||
if ((unsigned char)(*s) < ' ') {
|
||||
ch = *s;
|
||||
|
@ -5967,16 +5967,16 @@ spawn(const Arg *arg)
|
|||
if (dpy)
|
||||
close(ConnectionNumber(dpy));
|
||||
#if USEMOUSE
|
||||
if (arg->v == statuscmd) {
|
||||
for (int i = 0; i < LENGTH(statuscmds); i++) {
|
||||
if (statuscmdn == statuscmds[i].id) {
|
||||
statuscmd[2] = statuscmds[i].cmd;
|
||||
if (arg->v == clickstatus) {
|
||||
for (int i = 0; i < LENGTH(clickstatuss); i++) {
|
||||
if (clickstatusn == clickstatuss[i].id) {
|
||||
clickstatus[2] = clickstatuss[i].cmd;
|
||||
|
||||
/* compatibility with dwm bars */
|
||||
setenv("BUTTON", lastbutton, 1);
|
||||
int writestatus = fputs(lastbutton, buttonfile);
|
||||
if (writestatus == EOF) {
|
||||
fprintf(stderr, "speedwm: failed to write statuscmd button.\n");
|
||||
fprintf(stderr, "speedwm: failed to write clickstatus button.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -5985,7 +5985,7 @@ spawn(const Arg *arg)
|
|||
break;
|
||||
}
|
||||
}
|
||||
if (!statuscmd[2])
|
||||
if (!clickstatus[2])
|
||||
exit(EXIT_SUCCESS);
|
||||
}
|
||||
#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.
|
||||
*
|
||||
* 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.
|
||||
* Update interval: How often the module will be updated in seconds.
|
||||
* Update signal: What signal reloads the module with force. (using the kill command)
|
||||
|
|
|
@ -18,8 +18,10 @@
|
|||
* 2 - Middle 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_date --click", 2 },
|
||||
{ "module_bat --click", 3 },
|
||||
|
|
Loading…
Reference in a new issue