Adding statusbutton patch ref. #33

This commit is contained in:
bakkeby 2020-06-24 16:36:51 +02:00
parent 04906b4ddf
commit ce12e07163
4 changed files with 70 additions and 14 deletions

View File

@ -15,7 +15,7 @@ Refer to [https://dwm.suckless.org/](https://dwm.suckless.org/) for details on t
### Changelog:
2020-06-24 - Added resizepoint patch
2020-06-24 - Added resizepoint and statusbutton patches
2020-06-21 - Added floatpos and bar_height patches
@ -394,15 +394,18 @@ Refer to [https://dwm.suckless.org/](https://dwm.suckless.org/) for details on t
- [staticstatus](https://dwm.suckless.org/patches/staticstatus/)
- allows the status text to be fixed to the bar on a specific monitor rather than being drawn on the focused monitor
- [statuscmd](https://dwm.suckless.org/patches/statuscmd/)
- adds the ability to execute shell commands based on the mouse button and position when clicking the status bar
- [status2d](https://dwm.suckless.org/patches/status2d/)
- allows colors and rectangle drawing in the dwm status bar
- [statusallmons](https://dwm.suckless.org/patches/statuspadding/)
- this patch draws and updates the statusbar on all monitors
- [statusbutton](https://dwm.suckless.org/patches/statusbutton/)
- adds a clickable button to the left hand side of the statusbar
- [statuscmd](https://dwm.suckless.org/patches/statuscmd/)
- adds the ability to execute shell commands based on the mouse button and position when clicking the status bar
- [statuscolors](https://dwm.suckless.org/patches/statuscolors/)
- enables colored text in the status bar allowing multiple color combinations for use in the status script

View File

@ -42,6 +42,9 @@ static const int vertpadbar = 0; /* vertical padding for statusba
#if STATICSTATUS_PATCH && !STATUSALLMONS_PATCH
static const int statmonval = 0;
#endif // STATICSTATUS_PATCH
#if STATUSBUTTON_PATCH
static const char buttonbar[] = "<O>";
#endif // STATUSBUTTON_PATCH
#if SYSTRAY_PATCH
static const unsigned int systraypinning = 0; /* 0: sloppy systray follows selected monitor, >0: pin systray to monitor X */
static const unsigned int systrayspacing = 2; /* systray spacing */
@ -1134,9 +1137,16 @@ static Command commands[] = {
#endif // KEYMODES_PATCH
/* button definitions */
#if STATUSBUTTON_PATCH
/* click can be ClkButton, ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle, ClkClientWin, or ClkRootWin */
#else
/* click can be ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle, ClkClientWin, or ClkRootWin */
#endif //
static Button buttons[] = {
/* click event mask button function argument */
#if STATUSBUTTON_PATCH
{ ClkButton, 0, Button1, spawn, {.v = dmenucmd } },
#endif // STATUSBUTTON_PATCH
{ ClkLtSymbol, 0, Button1, setlayout, {0} },
{ ClkLtSymbol, 0, Button3, setlayout, {.v = &layouts[2]} },
#if AWESOMEBAR_PATCH

58
dwm.c
View File

@ -134,13 +134,29 @@ enum {
NetClientList, NetLast
}; /* EWMH atoms */
#if WINDOWROLERULE_PATCH
enum { WMProtocols, WMDelete, WMState, WMTakeFocus, WMWindowRole, WMLast }; /* default atoms */
#else
enum { WMProtocols, WMDelete, WMState, WMTakeFocus, WMLast }; /* default atoms */
#endif // WINDOWROLERULE_PATCH
enum { ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle,
ClkClientWin, ClkRootWin, ClkLast }; /* clicks */
enum {
WMProtocols,
WMDelete,
WMState,
WMTakeFocus,
#if WINDOWROLERULE_PATCH
WMWindowRole,
#endif // WINDOWROLERULE_PATCH
WMLast
}; /* default atoms */
enum {
#if STATUSBUTTON_PATCH
ClkButton,
#endif // STATUSBUTTON_PATCH
ClkTagBar,
ClkLtSymbol,
ClkStatusText,
ClkWinTitle,
ClkClientWin,
ClkRootWin,
ClkLast
}; /* clicks */
typedef union {
int i;
@ -827,8 +843,17 @@ buttonpress(XEvent *e)
x += blw;
if (ev->x < x) {
click = ClkLtSymbol;
#if STATUSBUTTON_PATCH
} else if (ev->x < (x += TEXTW(buttonbar))) {
click = ClkButton;
#endif // STATUSBUTTON_PATCH
} else {
#endif // LEFTLAYOUT_PATCH
#elif STATUSBUTTON_PATCH
x += TEXTW(buttonbar);
if (ev->x < x) {
click = ClkButton;
} else {
#endif // LEFTLAYOUT_PATCH | STATUSBUTTON_PATCH
#if HIDEVACANTTAGS_PATCH
for (c = m->clients; c; c = c->next)
occ |= c->tags == 255 ? 0 : c->tags;
@ -938,9 +963,9 @@ buttonpress(XEvent *e)
else
click = ClkWinTitle;
#endif // AWESOMEBAR_PATCH
#if LEFTLAYOUT_PATCH
#if LEFTLAYOUT_PATCH || STATUSBUTTON_PATCH
}
#endif // LEFTLAYOUT_PATCH
#endif // LEFTLAYOUT_PATCH | STATUSBUTTON_PATCH
} else if ((c = wintoclient(ev->window))) {
#if FOCUSONCLICK_PATCH
if (focusonwheel || (ev->button != Button4 && ev->button != Button5))
@ -1594,6 +1619,19 @@ drawbar(Monitor *m)
x = drw_text(drw, x, 0, w, bh, lrpad / 2, m->ltsymbol, 0);
#endif // PANGO_PATCH
#endif // LEFTLAYOUT_PATCH
#if STATUSBUTTON_PATCH
w = TEXTW(buttonbar);
#if VTCOLORS_PATCH
drw_setscheme(drw, scheme[SchemeTagsNorm]);
#else
drw_setscheme(drw, scheme[SchemeNorm]);
#endif // VTCOLORS_PATCH
#if PANGO_PATCH
x = drw_text(drw, x, 0, w, bh, lrpad / 2, buttonbar, 0, False);
#else
x = drw_text(drw, x, 0, w, bh, lrpad / 2, buttonbar, 0);
#endif // PANGO_PATCH
#endif // STATUSBUTTON_PATCH
#if TAGGRID_PATCH
if (drawtagmask & DRAWCLASSICTAGS)
#endif // TAGGRID_PATCH

View File

@ -588,6 +588,11 @@
*/
#define STATUSALLMONS_PATCH 0
/* This patch adds a clickable button to the left hand side of the statusbar.
* https://dwm.suckless.org/patches/statusbutton/
*/
#define STATUSBUTTON_PATCH 0
/* This patch enables colored text in the status bar. It changes the way colors are defined
* in config.h allowing multiple color combinations for use in the status script.
* This patch is incompatible with and takes precedence over the status2d patch.