dwm-noxz

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

commit: 7911386107e442d7cf26db00af21644a35b6a6ae
parent: d1f4d9e8428a00920d8740e517114a744b32c4e9
author: Chris Noxz <chris@noxz.tech>
date:   Tue, 7 Feb 2023 13:33:26 +0100
Draw icon at upper right corner
Mconfig.def.h22++++++++------------
Mdwm.c15+++++++++++--
2 files changed, 22 insertions(+), 15 deletions(-)
diff --git a/config.def.h b/config.def.h
@@ -33,12 +33,10 @@ static char col_tinfg[]         = COL_DEF;
 static char col_tinbg[]         = COL_DEF;
 static char col_tisfg[]         = COL_DEF;
 static char col_tisbg[]         = COL_DEF;
+static char col_wmifg[]         = COL_DEF;
+static char col_wmibg[]         = COL_DEF;
 static char col_snfg[]          = COL_DEF;
 static char col_snbg[]          = COL_DEF;
-static char col_safg[]          = COL_DEF;
-static char col_sabg[]          = COL_DEF;
-static char col_sdfg[]          = COL_DEF;
-static char col_sdbg[]          = COL_DEF;
 static char col_snofg[]         = COL_DEF;
 static char col_snobg[]         = COL_DEF;
 static char *colors[][4]        = {
@@ -51,11 +49,10 @@ static char *colors[][4]        = {
 	[SchemeLayout]          = { col_layfg,  col_laybg,  col_laybr,  col_none },
 	[SchemeTitleNorm]       = { col_tinfg,  col_tinbg,  col_none,   col_none },
 	[SchemeTitleSel]        = { col_tisfg,  col_tisbg,  col_none,   col_none },
+	[SchemeWMIcon]          = { col_wmifg,  col_wmibg,  col_none,   col_none },
 
 	[SchemeStatusNorm]      = { col_snfg,   col_snbg,   col_none,   col_none },
-	[SchemeStatusAct]       = { col_safg,   col_sabg,   col_none,   col_none },
-	[SchemeStatusDist]      = { col_sdfg,   col_sdbg,   col_none,   col_none },
-	[SchemeStatusNoti]      = { col_snofg,  col_snobg,  col_none,   col_none },
+	[SchemeStatusNotify]    = { col_snofg,  col_snobg,  col_none,   col_none },
 };
 
 /* tagging */
@@ -80,6 +77,7 @@ static int nmaster              = 1;    /* number of clients in master area */
 static int resizehints          = 0;    /* 1 means respect size hints in tiled resizals */
 
 static int r_basewidth          = 30;
+static int r_wmicon[]           = {13,4,3,3,17,8,3,3,9,12,3,3,13,12,3,3,17,12,3,3};
 static int r_nrowgrid[]         = {8,6,6,4,16,6,6,4,8,11,4,3,13,11,4,3,18,11,4,3};
 static int r_tile[]             = {8,6,8,4,8,11,8,3,17,6,5,2,17,9,5,2,17,12,5,2};
 static int r_monocle[]          = {8,6,4,1,18,6,4,1,8,13,4,1,18,13,4,1,8,7,1,2,21,7,1,2,8,11,1,2,21,11,1,2};
@@ -137,14 +135,12 @@ ResourcePref resources[] = {
 	{ "titleNormalBackground",      STRING,     &col_tinbg },
 	{ "titleSelectedForeground",    STRING,     &col_tisfg },
 	{ "titleSelectedBackground",    STRING,     &col_tisbg },
+	{ "wmIconForeground",           STRING,     &col_wmifg },
+	{ "wmIconBackground",           STRING,     &col_wmibg },
 	{ "statusNormalForeground",     STRING,     &col_snfg },
 	{ "statusNormalBackground",     STRING,     &col_snbg },
-	{ "statusActForeground",        STRING,     &col_safg },
-	{ "statusActBackground",        STRING,     &col_sabg },
-	{ "statusDistForeground",       STRING,     &col_sdfg },
-	{ "statusDistBackground",       STRING,     &col_sdbg },
-	{ "statusNotiForeground",       STRING,     &col_snofg },
-	{ "statusNotiBackground",       STRING,     &col_snobg },
+	{ "statusNotifyForeground",     STRING,     &col_snofg },
+	{ "statusNotifyBackground",     STRING,     &col_snobg },
 	{ "font",                       STRING,     &font },
 	{ "borderpx",                   INTEGER,    &borderpx },
 	{ "snap",                       INTEGER,    &snap },
diff --git a/dwm.c b/dwm.c
@@ -66,8 +66,8 @@ enum { DispUi, DispCmdLine }; /* dispatch types */
 enum { LayoutGrid, LayoutTiled, LayoutMonocle, LayoutFloating }; /* layouts, first is default */
 enum { CurNormal, CurResize, CurMove, CurLast }; /* cursor */
 enum { SchemeNorm, SchemeSel, SchemeTagsNorm, SchemeTagsIncl, SchemeTagsSel,
-	SchemeLayout, SchemeTitleNorm, SchemeTitleSel, SchemeStatusNorm,
-	SchemeStatusAct, SchemeStatusDist, SchemeStatusNoti }; /* color schemes */
+       SchemeLayout, SchemeTitleNorm, SchemeTitleSel, SchemeWMIcon,
+       SchemeStatusNorm, SchemeStatusNotify }; /* color schemes */
 enum { NetSupported, NetWMName, NetWMState, NetWMCheck,
        NetWMFullscreen, NetActiveWindow, NetWMWindowType,
        NetWMWindowTypeDialog, NetClientList, NetClientInfo, NetTagState, NetLast }; /* EWMH atoms */
@@ -904,6 +904,7 @@ drawbar(Monitor *m)
 			tp = ++ts;
 		}
 		tw += 2; /* 2px right padding */
+		tx = -r_basewidth;
 		ts = stext;
 		tp = stext;
 		while (1) {
@@ -917,6 +918,16 @@ drawbar(Monitor *m)
 			*ts = ctmp;
 			tp = ++ts;
 		}
+		tw += r_basewidth;
+	}
+
+	/* draw wm icon */
+	x = m->ww - r_basewidth;
+	drw_setscheme(drw, scheme[SchemeWMIcon]);
+	drw_rect(drw, x, 0, r_basewidth, bh, 1, 1);
+	if (LENGTH(r_wmicon) % 4 == 0) { /* draw wm icon */
+		for (i = 0; i < LENGTH(r_wmicon); i+=4)
+			drw_rect(drw, x + r_wmicon[i], r_wmicon[i+1], r_wmicon[i+2], r_wmicon[i+3], 1, 0);
 	}
 
 	for (i = 0; i < LENGTH(tags); i++)