rename Clk buttons

This commit is contained in:
speedie 2022-12-30 15:05:50 +01:00
parent 4d4a2b69c2
commit b7300b075d
10 changed files with 47 additions and 46 deletions

View file

@ -24,6 +24,6 @@ click_ltsymbol(Bar *bar, Arg *arg, BarClickArg *a)
if (selmon->hidelayout) { if (selmon->hidelayout) {
return 0; return 0;
} else { } else {
return ClkLtSymbol; return clicklayout;
} }
} }

View file

@ -26,6 +26,6 @@ click_status_basic(Bar *bar, Arg *arg, BarClickArg *a)
if (selmon->hidestatus) { if (selmon->hidestatus) {
return 0; return 0;
} else { } else {
return ClkStatusText; return clickstatusbar;
} }
} }

View file

@ -4,7 +4,7 @@ click_status_pwl(Bar *bar, Arg *arg, BarClickArg *a)
if (selmon->hidestatus) { if (selmon->hidestatus) {
return 0; return 0;
} else { } else {
return ClkStatusText; return clickstatusbar;
} }
} }

View file

@ -196,7 +196,7 @@ click_status_text(Arg *arg, int rel_x, char *text)
} }
} }
#endif #endif
return ClkStatusText; return clickstatusbar;
} }
void void

View file

@ -128,5 +128,5 @@ click_tags_pwl(Bar *bar, Arg *arg, BarClickArg *a)
if (i < LENGTH(tags)) { if (i < LENGTH(tags)) {
arg->ui = 1 << i; arg->ui = 1 << i;
} }
return ClkTagBar; return clicktags;
} }

View file

@ -101,5 +101,5 @@ click_tags(Bar *bar, Arg *arg, BarClickArg *a)
if (i < LENGTH(tags)) { if (i < LENGTH(tags)) {
arg->ui = 1 << i; arg->ui = 1 << i;
} }
return ClkTagBar; return clicktags;
} }

View file

@ -59,5 +59,5 @@ click_title_basic(Bar *bar, Arg *arg, BarClickArg *a)
return 0; return 0;
} }
return ClkWinTitle; return clicktitle;
} }

View file

@ -100,7 +100,7 @@ click_title(Bar *bar, Arg *arg, BarClickArg *a)
if (c) { if (c) {
arg->v = c; arg->v = c;
return ClkWinTitle; return clicktitle;
} }
return -1; return -1;
} }

53
mouse.h
View file

@ -6,11 +6,12 @@
* *
* To disable all mouse binds, edit toggle.h. * To disable all mouse binds, edit toggle.h.
* *
* ClkLtSymbol - Layout icon * clicklayout - Layout icon
* ClkWinTitle - Window title * clicktitle - Window title
* ClkStatusText - Status text * clickstatusbar - Status text
* ClkRootWin - Root window (background) * clickroot - Root window (background)
* ClkTagBar - Tags * clicktags - Tags
* clickclient - Window
* *
* Button1 - Left click * Button1 - Left click
* Button2 - Middle click * Button2 - Middle click
@ -21,25 +22,25 @@
/* Actions when the mouse clicks a part of the screen */ /* Actions when the mouse clicks a part of the screen */
static const Button buttons[] = { static const Button buttons[] = {
/* click event mask button function argument */ /* click event mask button function argument */
{ ClkLtSymbol, 0, Button2, spawn, cmd( "speedwm-utils layout" ) }, { clicklayout, 0, Button2, spawn, cmd( "speedwm-utils layout" ) },
{ ClkLtSymbol, 0, Button1, cyclelayout, {.i = +1 } }, { clicklayout, 0, Button1, cyclelayout, {.i = +1 } },
{ ClkLtSymbol, 0, Button3, cyclelayout, {.i = -1 } }, { clicklayout, 0, Button3, cyclelayout, {.i = -1 } },
{ ClkLtSymbol, 0, Button4, cyclelayout, {.i = +1 } }, { clicklayout, 0, Button4, cyclelayout, {.i = +1 } },
{ ClkLtSymbol, 0, Button5, cyclelayout, {.i = -1 } }, { clicklayout, 0, Button5, cyclelayout, {.i = -1 } },
{ ClkWinTitle, 0, Button2, zoom, {0} }, { clicktitle, 0, Button2, zoom, {0} },
{ ClkClientWin, MODIFIER1, Button1, moveorplace, {.i = 1} }, { clickclient, MODIFIER1, Button1, moveorplace, {.i = 1} },
{ ClkClientWin, MODIFIER1, Button2, togglefloating, {0} }, { clickclient, MODIFIER1, Button2, togglefloating, {0} },
{ ClkClientWin, MODIFIER1|ControlMask, Button3, dragcfact, {0} }, { clickclient, MODIFIER1|ControlMask, Button3, dragcfact, {0} },
{ ClkClientWin, MODIFIER1, Button3, dragmfact, {0} }, { clickclient, MODIFIER1, Button3, dragmfact, {0} },
{ ClkStatusText, 0, Button1, spawn, {.v = clickstatus } }, { clickstatusbar, 0, Button1, spawn, {.v = clickstatus } },
{ ClkStatusText, 0, Button2, spawn, {.v = clickstatus } }, { clickstatusbar, 0, Button2, spawn, {.v = clickstatus } },
{ ClkStatusText, 0, Button3, spawn, {.v = clickstatus } }, { clickstatusbar, 0, Button3, spawn, {.v = clickstatus } },
{ ClkWinTitle, 0, Button3, spawn, cmd( "speedwm-utils" ) }, { clicktitle, 0, Button3, spawn, cmd( "speedwm-utils" ) },
{ ClkRootWin, 0, Button3, spawn, cmd( "j4-dmenu-desktop --term=st --dmenu='dmenu -l 20 -p Open:'" ) }, { clickroot, 0, Button3, spawn, cmd( "j4-dmenu-desktop --term=st --dmenu='dmenu -l 20 -p Open:'" ) },
{ ClkTagBar, 0, Button1, view, {0} }, { clicktags, 0, Button1, view, {0} },
{ ClkTagBar, 0, Button4, viewtoleft, {0} }, { clicktags, 0, Button4, viewtoleft, {0} },
{ ClkTagBar, 0, Button5, viewtoright, {0} }, { clicktags, 0, Button5, viewtoright, {0} },
{ ClkTagBar, MODIFIER1, Button4, viewtoleft_vacant, {0} }, { clicktags, MODIFIER1, Button4, viewtoleft_vacant, {0} },
{ ClkTagBar, MODIFIER1, Button5, viewtoright_vacant, {0} }, { clicktags, MODIFIER1, Button5, viewtoright_vacant, {0} },
}; };

View file

@ -140,13 +140,13 @@ enum { WMClass,
}; };
/* clicks */ /* clicks */
enum { ClkTagBar, enum { clicktags,
ClkLtSymbol, clicklayout,
ClkStatusText, clickstatusbar,
ClkWinTitle, clicktitle,
ClkClientWin, clickclient,
ClkRootWin, clickroot,
ClkLast, clicklast,
}; };
#if USEIPC #if USEIPC
@ -1370,7 +1370,7 @@ buttonpress(XEvent *e)
const BarRule *br; const BarRule *br;
BarClickArg carg = { 0, 0, 0, 0 }; BarClickArg carg = { 0, 0, 0, 0 };
click = ClkRootWin; click = clickroot;
/* focus monitor if necessary */ /* focus monitor if necessary */
if ((m = wintomon(ev->window)) && m != selmon if ((m = wintomon(ev->window)) && m != selmon
) { ) {
@ -1403,17 +1403,17 @@ buttonpress(XEvent *e)
} }
} }
if (click == ClkRootWin && (c = wintoclient(ev->window))) { if (click == clickroot && (c = wintoclient(ev->window))) {
focus(c); focus(c);
restack(selmon); restack(selmon);
XAllowEvents(dpy, ReplayPointer, CurrentTime); XAllowEvents(dpy, ReplayPointer, CurrentTime);
click = ClkClientWin; click = clickclient;
} }
for (i = 0; i < LENGTH(buttons); i++) { for (i = 0; i < LENGTH(buttons); i++) {
if (click == buttons[i].click && buttons[i].func && buttons[i].button == ev->button if (click == buttons[i].click && buttons[i].func && buttons[i].button == ev->button
&& CLEANMASK(buttons[i].mask) == CLEANMASK(ev->state)) { && CLEANMASK(buttons[i].mask) == CLEANMASK(ev->state)) {
buttons[i].func(click == ClkTagBar && buttons[i].arg.i == 0 ? &arg : &buttons[i].arg); buttons[i].func(click == clicktags && buttons[i].arg.i == 0 ? &arg : &buttons[i].arg);
} }
} }
} }
@ -2613,7 +2613,7 @@ grabbuttons(Client *c, int focused)
BUTTONMASK, GrabModeSync, GrabModeSync, None, None); BUTTONMASK, GrabModeSync, GrabModeSync, None, None);
#if USEMOUSE #if USEMOUSE
for (i = 0; i < LENGTH(buttons); i++) for (i = 0; i < LENGTH(buttons); i++)
if (buttons[i].click == ClkClientWin) if (buttons[i].click == clickclient)
for (j = 0; j < LENGTH(modifiers); j++) for (j = 0; j < LENGTH(modifiers); j++)
XGrabButton(dpy, buttons[i].button, XGrabButton(dpy, buttons[i].button,
buttons[i].mask | modifiers[j], buttons[i].mask | modifiers[j],