diff options
-rw-r--r-- | applied/dwm-dash_above_activeWindow-20240604-061e9fe.diff | 44 | ||||
-rw-r--r-- | applied/dwm-fancybar-20220527-d3f93c7.diff | 73 | ||||
-rw-r--r-- | applied/dwm-notitle-20210715-138b405.diff | 81 | ||||
-rw-r--r-- | config.def.h | 6 | ||||
-rw-r--r-- | dwm.c | 50 |
5 files changed, 87 insertions, 167 deletions
diff --git a/applied/dwm-dash_above_activeWindow-20240604-061e9fe.diff b/applied/dwm-dash_above_activeWindow-20240604-061e9fe.diff deleted file mode 100644 index 4d66f6c..0000000 --- a/applied/dwm-dash_above_activeWindow-20240604-061e9fe.diff +++ /dev/null @@ -1,44 +0,0 @@ -From 89303c44ed3c65e106f7e2e7711c112867226695 Mon Sep 17 00:00:00 2001 -From: DonRehan <30264386+donRehan@users.noreply.github.com> -Date: Tue, 4 Jun 2024 04:33:48 +0300 -Subject: [PATCH] Add a dash above current active window in dwm bar - -Give user ability to modify its position , width and text position. ---- - config.def.h | 3 +++ - dwm.c | 4 +++- - 2 files changed, 6 insertions(+), 1 deletion(-) - -diff --git a/config.def.h b/config.def.h -index 9efa774..2ec5f52 100644 ---- a/config.def.h -+++ b/config.def.h -@@ -2,6 +2,9 @@ - - /* appearance */ - static const unsigned int borderpx = 1; /* border pixel of windows */ -+static const unsigned int brdsh_w = 2; /* width of the app bar dash */ -+static const unsigned int brdsh_ypos = 18; /* y-position of the dash */ -+static const unsigned int text_ypos = 1; /* y-position of text */ - static const unsigned int snap = 32; /* snap pixel */ - static const int showbar = 1; /* 0 means no bar */ - static const int topbar = 1; /* 0 means bottom bar */ -diff --git a/dwm.c b/dwm.c -index f1d86b2..3c9b293 100644 ---- a/dwm.c -+++ b/dwm.c -@@ -736,8 +736,10 @@ drawbar(Monitor *m) - - if ((w = m->ww - tw - x) > bh) { - if (m->sel) { -+ drw_setscheme(drw, scheme[SchemeNorm]); -+ drw_text(drw, x, text_ypos, w, bh, lrpad / 2, m->sel->name, 0); - drw_setscheme(drw, scheme[m == selmon ? SchemeSel : SchemeNorm]); -- drw_text(drw, x, 0, w, bh, lrpad / 2, m->sel->name, 0); -+ drw_rect(drw, x , bh - brdsh_ypos , w , brdsh_w , 1, 1); - if (m->sel->isfloating) - drw_rect(drw, x + boxs, boxs, boxw, boxw, m->sel->isfixed, 0); - } else { --- -2.34.1 - diff --git a/applied/dwm-fancybar-20220527-d3f93c7.diff b/applied/dwm-fancybar-20220527-d3f93c7.diff deleted file mode 100644 index e2a4e2a..0000000 --- a/applied/dwm-fancybar-20220527-d3f93c7.diff +++ /dev/null @@ -1,73 +0,0 @@ -diff --git a/dwm.c b/dwm.c ---- a/dwm.c -+++ b/dwm.c -@@ -699,10 +699,10 @@ dirtomon(int dir) - void - drawbar(Monitor *m) - { -- int x, w, tw = 0; -+ int x, w, tw = 0, mw, ew = 0; - int boxs = drw->fonts->h / 9; - int boxw = drw->fonts->h / 6 + 2; -- unsigned int i, occ = 0, urg = 0; -+ unsigned int i, occ = 0, urg = 0, n = 0; - Client *c; - - if (!m->showbar) -@@ -716,6 +716,8 @@ drawbar(Monitor *m) - } - - for (c = m->clients; c; c = c->next) { -+ if (ISVISIBLE(c)) -+ n++; - occ |= c->tags; - if (c->isurgent) - urg |= c->tags; -@@ -736,15 +738,39 @@ drawbar(Monitor *m) - x = drw_text(drw, x, 0, w, bh, lrpad / 2, m->ltsymbol, 0); - - if ((w = m->ww - tw - x) > bh) { -- if (m->sel) { -- drw_setscheme(drw, scheme[m == selmon ? SchemeSel : SchemeNorm]); -- drw_text(drw, x, 0, w, bh, lrpad / 2, m->sel->name, 0); -- if (m->sel->isfloating) -- drw_rect(drw, x + boxs, boxs, boxw, boxw, m->sel->isfixed, 0); -- } else { -- drw_setscheme(drw, scheme[SchemeNorm]); -- drw_rect(drw, x, 0, w, bh, 1, 1); -+ if (n > 0) { -+ tw = TEXTW(m->sel->name) + lrpad; -+ mw = (tw >= w || n == 1) ? 0 : (w - tw) / (n - 1); -+ -+ i = 0; -+ for (c = m->clients; c; c = c->next) { -+ if (!ISVISIBLE(c) || c == m->sel) -+ continue; -+ tw = TEXTW(c->name); -+ if(tw < mw) -+ ew += (mw - tw); -+ else -+ i++; -+ } -+ if (i > 0) -+ mw += ew / i; -+ -+ for (c = m->clients; c; c = c->next) { -+ if (!ISVISIBLE(c)) -+ continue; -+ tw = MIN(m->sel == c ? w : mw, TEXTW(c->name)); -+ -+ drw_setscheme(drw, scheme[m == selmon && m->sel == c ? SchemeSel : SchemeNorm]); -+ if (tw > lrpad / 2) -+ drw_text(drw, x, 0, tw, bh, lrpad / 2, c->name, 0); -+ if (c->isfloating) -+ drw_rect(drw, x + boxs, boxs, boxw, boxw, c->isfixed, 0); -+ x += tw; -+ w -= tw; -+ } - } -+ drw_setscheme(drw, scheme[SchemeNorm]); -+ drw_rect(drw, x, 0, w, bh, 1, 1); - } - drw_map(drw, m->barwin, 0, 0, m->ww, bh); - } diff --git a/applied/dwm-notitle-20210715-138b405.diff b/applied/dwm-notitle-20210715-138b405.diff new file mode 100644 index 0000000..bc8a3e5 --- /dev/null +++ b/applied/dwm-notitle-20210715-138b405.diff @@ -0,0 +1,81 @@ +From a3a7e94f59553689656871a65ea9ce90169a7c91 Mon Sep 17 00:00:00 2001 +From: birdalicous <jack.bird@durham.ac.uk> +Date: Thu, 15 Jul 2021 12:28:29 +0100 +Subject: [PATCH] notitle patch applied# + +--- + config.def.h | 1 - + dwm.c | 20 ++++---------------- + 2 files changed, 4 insertions(+), 17 deletions(-) + +diff --git a/config.def.h b/config.def.h +index a2ac963..eac20b4 100644 +--- a/config.def.h ++++ b/config.def.h +@@ -103,7 +103,6 @@ static Button buttons[] = { + /* click event mask button function argument */ + { ClkLtSymbol, 0, Button1, setlayout, {0} }, + { ClkLtSymbol, 0, Button3, setlayout, {.v = &layouts[2]} }, +- { ClkWinTitle, 0, Button2, zoom, {0} }, + { ClkStatusText, 0, Button2, spawn, {.v = termcmd } }, + { ClkClientWin, MODKEY, Button1, movemouse, {0} }, + { ClkClientWin, MODKEY, Button2, togglefloating, {0} }, +diff --git a/dwm.c b/dwm.c +index 5e4d494..6cd9fb7 100644 +--- a/dwm.c ++++ b/dwm.c +@@ -64,8 +64,8 @@ enum { NetSupported, NetWMName, NetWMState, NetWMCheck, + NetWMFullscreen, NetActiveWindow, NetWMWindowType, + NetWMWindowTypeDialog, NetClientList, NetLast }; /* EWMH atoms */ + enum { WMProtocols, WMDelete, WMState, WMTakeFocus, WMLast }; /* default atoms */ +-enum { ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle, +- ClkClientWin, ClkRootWin, ClkLast }; /* clicks */ ++enum { ClkTagBar, ClkLtSymbol, ClkStatusText, ClkClientWin, ++ ClkRootWin, ClkLast }; /* clicks */ + + typedef union { + int i; +@@ -440,10 +440,8 @@ buttonpress(XEvent *e) + arg.ui = 1 << i; + } else if (ev->x < x + blw) + click = ClkLtSymbol; +- else if (ev->x > selmon->ww - (int)TEXTW(stext)) +- click = ClkStatusText; + else +- click = ClkWinTitle; ++ click = ClkStatusText; + } else if ((c = wintoclient(ev->window))) { + focus(c); + restack(selmon); +@@ -730,15 +728,8 @@ drawbar(Monitor *m) + x = drw_text(drw, x, 0, w, bh, lrpad / 2, m->ltsymbol, 0); + + if ((w = m->ww - tw - x) > bh) { +- if (m->sel) { +- drw_setscheme(drw, scheme[m == selmon ? SchemeSel : SchemeNorm]); +- drw_text(drw, x, 0, w, bh, lrpad / 2, m->sel->name, 0); +- if (m->sel->isfloating) +- drw_rect(drw, x + boxs, boxs, boxw, boxw, m->sel->isfixed, 0); +- } else { + drw_setscheme(drw, scheme[SchemeNorm]); + drw_rect(drw, x, 0, w, bh, 1, 1); +- } + } + drw_map(drw, m->barwin, 0, 0, m->ww, bh); + } +@@ -1236,11 +1227,8 @@ propertynotify(XEvent *e) + drawbars(); + break; + } +- if (ev->atom == XA_WM_NAME || ev->atom == netatom[NetWMName]) { ++ if (ev->atom == XA_WM_NAME || ev->atom == netatom[NetWMName]) + updatetitle(c); +- if (c == c->mon->sel) +- drawbar(c->mon); +- } + if (ev->atom == netatom[NetWMWindowType]) + updatewindowtype(c); + } +-- +2.32.0 + diff --git a/config.def.h b/config.def.h index b3c9525..dae6ecc 100644 --- a/config.def.h +++ b/config.def.h @@ -2,9 +2,6 @@ /* appearance */ static const unsigned int borderpx = 3; /* border pixel of windows */ -static const unsigned int brdsh_w = 3; /* width of the app bar dash */ -static const unsigned int brdsh_ypos = 25; /* y-position of the dash */ -static const unsigned int text_ypos = 1; /* y-position of text */ static const unsigned int gappx = 6; /* gaps between windows */ static const unsigned int snap = 24; /* snap pixel */ static const int swallowfloating = 1; /* 1 means swallow floating windows by default */ @@ -17,7 +14,7 @@ static const int showbar = 0; /* 0 means no bar */ static const int topbar = 1; /* 0 means bottom bar */ static const int user_bh = 25; /* 0 means that dwm will calculate bar height, >= 1 means dwm will user_bh as bar height */ static const int focusonwheel = 0; -static const char *fonts[] = { "NotoSansMono Nerd Font:size=14" }; +static const char *fonts[] = { "NotoSansMono Nerd Font:size=13" }; static const char dmenufont[] = "monospace:size=11"; static const char col_gray1[] = "#1d2021"; /* bar background */ static const char col_gray2[] = "#32302f"; /* last square, windows borders */ @@ -290,7 +287,6 @@ static const Button buttons[] = { /* click event mask button function argument */ { ClkLtSymbol, 0, Button1, setlayout, {0} }, { ClkLtSymbol, 0, Button3, setlayout, {.v = &layouts[2]} }, - { ClkWinTitle, 0, Button2, zoom, {0} }, { ClkStatusText, 0, Button2, spawn, {.v = term_cmd } }, { ClkClientWin, MODKEY, Button1, movemouse, {0} }, { ClkClientWin, MODKEY, Button2, togglefloating, {0} }, @@ -88,7 +88,7 @@ enum { NetSupported, NetWMName, NetWMState, NetWMCheck, NetWMWindowTypeDialog, NetClientList, NetLast }; /* EWMH atoms */ enum { Manager, Xembed, XembedInfo, XLast }; /* Xembed atoms */ enum { WMProtocols, WMDelete, WMState, WMTakeFocus, WMLast }; /* default atoms */ -enum { ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle, +enum { ClkTagBar, ClkLtSymbol, ClkStatusText, ClkClientWin, ClkRootWin, ClkLast }; /* clicks */ typedef union { @@ -630,10 +630,8 @@ buttonpress(XEvent *e) } else if (ev->x < x + TEXTW(selmon->ltsymbol) + columns * bh / tagrows) click = ClkLtSymbol; - else if (ev->x > selmon->ww - (int)TEXTW(stext) - getsystraywidth()) - click = ClkStatusText; else - click = ClkWinTitle; + click = ClkStatusText; } else if ((c = wintoclient(ev->window))) { if (focusonwheel || (ev->button != Button4 && ev->button != Button5)) focus(c); @@ -1131,10 +1129,10 @@ dirtomon(int dir) void drawbar(Monitor *m) { - int x, w, tw = 0, mw, ew = 0, stw = 0; + int x, w, tw = 0, stw = 0; int boxs = drw->fonts->h / 9; int boxw = drw->fonts->h / 6 + 2; - unsigned int i, occ = 0, urg = 0, n = 0; + unsigned int i, occ = 0, urg = 0; Client *c; if (!m->showbar) @@ -1150,8 +1148,6 @@ drawbar(Monitor *m) resizebarwin(m); for (c = m->clients; c; c = c->next) { - if (ISVISIBLE(c)) - n++; occ |= c->tags; if (c->isurgent) urg |= c->tags; @@ -1176,39 +1172,6 @@ drawbar(Monitor *m) x = drw_text(drw, x, 0, w, bh, lrpad / 2, m->ltsymbol, 0); if ((w = m->ww - tw - stw - x) > bh) { - if (n > 0) { - tw = TEXTW(m->sel->name) + lrpad; - mw = (tw >= w || n == 1) ? 0 : (w - tw) / (n - 1); - - i = 0; - for (c = m->clients; c; c = c->next) { - if (!ISVISIBLE(c) || c == m->sel) - continue; - tw = TEXTW(c->name); - if(tw < mw) - ew += (mw - tw); - else - i++; - } - if (i > 0) - mw += ew / i; - - for (c = m->clients; c; c = c->next) { - if (!ISVISIBLE(c)) - continue; - tw = MIN(m->sel == c ? w : mw, TEXTW(c->name)); - - drw_setscheme(drw, scheme[SchemeNorm]); - if (tw > lrpad / 2) - drw_text(drw, x, text_ypos, tw, bh, lrpad / 2, c->name, 0); - drw_setscheme(drw, scheme[m == selmon && m->sel == c ? SchemeSel : SchemeNorm]); - drw_rect(drw, x , bh - brdsh_ypos , tw , brdsh_w , 1, 1); - if (c->isfloating) - drw_rect(drw, x + boxs, boxs, boxw, boxw, c->isfixed, 0); - x += tw; - w -= tw; - } - } drw_setscheme(drw, scheme[SchemeNorm]); drw_rect(drw, x, 0, w, bh, 1, 1); } @@ -2038,11 +2001,8 @@ propertynotify(XEvent *e) drawbars(); break; } - if (ev->atom == XA_WM_NAME || ev->atom == netatom[NetWMName]) { + if (ev->atom == XA_WM_NAME || ev->atom == netatom[NetWMName]) updatetitle(c); - if (c == c->mon->sel) - drawbar(c->mon); - } if (ev->atom == netatom[NetWMWindowType]) updatewindowtype(c); } |