dwm-noxz

[fork] suckless dwm - personal fork
git clone https://noxz.tech/git/dwm-noxz.git
Log | Files | README | LICENSE

commit: d581a52b9de585cb9ad89b635c725de2807f6c7b
parent: 934cb80a0edba630e7b918b5ff1a9d680b2c0d19
author: Chris Noxz <chris@noxz.tech>
date:   Mon, 13 Mar 2023 14:20:13 +0100
Add right click menu to logo
Mconfig.def.h2++
Mdwm.c4+++-
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/config.def.h b/config.def.h
@@ -93,6 +93,7 @@ static const Layout layouts[] = {
 
 /* context menu command used when right clicking root window */
 static const char *ctxmenucmd[]  = { "appmenu", NULL };
+static const char *ctxmenucmd_alt[]  = { "appmenu", "wmicon", NULL };
 
 /* button definitions */
 /* click can be ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle, ClkClientWin, or ClkRootWin */
@@ -111,6 +112,7 @@ static Button buttons[] = {
 	{ ClkTagBar,        Mod4Mask,       Button1,    tag,            {0} },
 	{ ClkTagBar,        0,              Button2,    tag,            {0} },
 	{ ClkTagBar,        Mod4Mask,       Button3,    toggletag,      {0} },
+	{ ClkWMIcon,        0,              Button3,    spawn,          {.v = ctxmenucmd_alt } },
 	{ ClkRootWin,       0,              Button3,    spawn,          {.v = ctxmenucmd } },
 };
 
diff --git a/dwm.c b/dwm.c
@@ -73,7 +73,7 @@ enum { NetSupported, NetWMName, NetWMState, NetWMCheck,
        NetWMWindowTypeDialog, NetClientList, NetClientInfo, NetTagState, NetLast }; /* EWMH atoms */
 enum { WMProtocols, WMDelete, WMState, WMTakeFocus, WMLast }; /* default atoms */
 enum { ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle,
-       ClkClientWin, ClkRootWin, ClkLast }; /* clicks */
+       ClkClientWin, ClkRootWin, ClkLast, ClkWMIcon }; /* clicks */
 
 typedef union {
 	int i;
@@ -509,6 +509,8 @@ buttonpress(XEvent *e)
 			arg.ui = 1 << i;
 		} else if (ev->x < x + blw)
 			click = ClkLtSymbol;
+		else if (ev->x > selmon->ww - i_basewidth)
+			click = ClkWMIcon;
 		else if (ev->x > selmon->ww - (int)TEXTW(stext))
 			click = ClkStatusText;
 		else