diff --git a/dwm/Makefile b/dwm/Makefile index 40376a0..22214ba 100644 --- a/dwm/Makefile +++ b/dwm/Makefile @@ -20,7 +20,7 @@ dwm: ${OBJ} ${CC} -o $@ ${OBJ} ${LDFLAGS} clean: - rm -f dwm *.rej *.orig config.h ${OBJ} dwm-${VERSION}.tar.gz + rm -f dwm ${OBJ} dwm-${VERSION}.tar.gz dist: clean mkdir -p dwm-${VERSION} @@ -29,6 +29,7 @@ dist: clean tar -cf dwm-${VERSION}.tar dwm-${VERSION} gzip dwm-${VERSION}.tar rm -rf dwm-${VERSION} + rm config.h install: all mkdir -p ${DESTDIR}${PREFIX}/bin @@ -38,6 +39,10 @@ install: all sed "s/VERSION/${VERSION}/g" < dwm.1 > ${DESTDIR}${MANPREFIX}/man1/dwm.1 chmod 644 ${DESTDIR}${MANPREFIX}/man1/dwm.1 +desktop: + mkdir -p /usr/share/xsessions/ + cp ./desktop/dwm.desktop /usr/share/xsessions/ + uninstall: rm -f ${DESTDIR}${PREFIX}/bin/dwm\ ${DESTDIR}${MANPREFIX}/man1/dwm.1 diff --git a/dwm/README.md b/dwm/README.md new file mode 100644 index 0000000..16312a3 --- /dev/null +++ b/dwm/README.md @@ -0,0 +1,27 @@ +# Dynamic Window Manager + +## Dependency (依赖) +```bash +Imlib2 +``` + +## fonts (字体) +```bash +ttf-hack-nerd +wqy-microhei +noto-fonts-emoji +``` + +## Shortcut key (快捷键) +| 快捷键 | 结果 | +|------------------------| --------------- | +| `Win + p` | 打开菜单 | +| `Win + Return` | 打开终端 | +| `Win + r` | 刷新壁纸 | +| `Win + a` | 截屏 | +| `Win + '` | 打开浮动终端 | +| `Win + Shift + Return` | 设置主窗口 | +| `Win + b` | 关闭/打开状态栏 | +| `Win + Tab` | 切换标签页 | +| `Win + Shfit + q` | 关闭窗口 | +| `Win + Shift + c` | 关闭 DWM | diff --git a/dwm/config.def.h b/dwm/config.def.h index f1dac10..4ed2339 100644 --- a/dwm/config.def.h +++ b/dwm/config.def.h @@ -3,13 +3,13 @@ /* appearance */ static const unsigned int borderpx = 1; /* border pixel of windows */ static const unsigned int snap = 32; /* snap pixel */ +static const int scalepreview = 4; /* preview scaling (display w and h / scalepreview) */ +static const int previewbar = 1; /* show the bar in the preview window */ static const unsigned int gappih = 20; /* horiz inner gap between windows */ static const unsigned int gappiv = 10; /* vert inner gap between windows */ static const unsigned int gappoh = 10; /* horiz outer gap between windows and screen edge */ -static const unsigned int gappov = 30; /* vert outer gap between windows and screen edge */ +static const unsigned int gappov = 20; /* vert outer gap between windows and screen edge */ static int smartgaps = 0; /* 1 means no outer gap when there is only one window */ -static const int scalepreview = 4; /* preview scaling (display w and h / scalepreview) */ -static const int previewbar = 1; /* show the bar in the preview window */ static const unsigned int systraypinning = 0; /* 0: sloppy systray follows selected monitor, >0: pin systray to monitor X */ static const unsigned int systrayonleft = 0; /* 0: systray in the right corner, >0: systray on left of status text */ static const unsigned int systrayspacing = 2; /* systray spacing */ @@ -29,153 +29,158 @@ static const char col_gray3[] = "#bbbbbb"; static const char col_gray4[] = "#eeeeee"; static const char col_cyan[] = "#005577"; static const char *colors[][3] = { - /* fg bg border */ - [SchemeNorm] = { col_gray3, col_gray1, col_gray2 }, - [SchemeSel] = { col_gray4, col_cyan, col_cyan }, - [SchemeHid] = { col_cyan, col_gray1, col_cyan }, + /* fg bg border */ + [SchemeNorm] = { col_gray3, col_gray1, col_gray2 }, + [SchemeSel] = { col_gray4, col_cyan, col_cyan }, + [SchemeHov] = { col_gray4, col_cyan, col_cyan }, + [SchemeHid] = { col_cyan, col_gray1, col_cyan }, }; /* tagging */ static const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" }; static const Rule rules[] = { - /* xprop(1): - * WM_CLASS(STRING) = instance, class - * WM_NAME(STRING) = title - */ - /* class instance title tags mask isfloating monitor */ - { "Gimp", NULL, NULL, 0, 1, -1 }, - { "Firefox", NULL, NULL, 1 << 8, 0, -1 }, + /* xprop(1): + * WM_CLASS(STRING) = instance, class + * WM_NAME(STRING) = title + */ + /* class instance title tags mask isfloating monitor */ + { "google-chrom", NULL, NULL, 1 << 8, 0, -1 }, }; /* layout(s) */ static const float mfact = 0.55; /* factor of master area size [0.05..0.95] */ static const int nmaster = 1; /* number of clients in master area */ static const int resizehints = 1; /* 1 means respect size hints in tiled resizals */ -static const int lockfullscreen = 1; /* 1 will force focus on the fullscreen window */ - #define FORCE_VSPLIT 1 /* nrowgrid layout: force two clients to always split vertically */ #include "vanitygaps.c" +static const int lockfullscreen = 1; /* 1 will force focus on the fullscreen window */ static const Layout layouts[] = { - /* symbol arrange function */ - { "[]=", tile }, /* first entry is default */ - { "[M]", monocle }, - { "[@]", spiral }, - { "[\\]", dwindle }, - { "H[]", deck }, - { "TTT", bstack }, - { "===", bstackhoriz }, - { "HHH", grid }, - { "###", nrowgrid }, - { "---", horizgrid }, - { ":::", gaplessgrid }, - { "|M|", centeredmaster }, - { ">M>", centeredfloatingmaster }, - { "><>", NULL }, /* no layout function means floating behavior */ - { NULL, NULL }, + /* symbol arrange function */ + { "[]=", tile }, /* first entry is default */ + { "[M]", monocle }, + { "[@]", spiral }, + { "[\\]", dwindle }, + { "H[]", deck }, + { "TTT", bstack }, + { "===", bstackhoriz }, + { "HHH", grid }, + { "###", nrowgrid }, + { "---", horizgrid }, + { ":::", gaplessgrid }, + { "|M|", centeredmaster }, + { ">M>", centeredfloatingmaster }, + { "><>", NULL }, /* no layout function means floating behavior */ + { NULL, NULL }, }; /* key definitions */ #define MODKEY Mod4Mask #define TAGKEYS(KEY,TAG) \ - { MODKEY, KEY, view, {.ui = 1 << TAG} }, \ - { MODKEY|ControlMask, KEY, toggleview, {.ui = 1 << TAG} }, \ - { MODKEY|ShiftMask, KEY, tag, {.ui = 1 << TAG} }, \ - { MODKEY|ControlMask|ShiftMask, KEY, previewtag, {.ui = TAG } }, \ + { MODKEY, KEY, view, {.ui = 1 << TAG} }, \ + { MODKEY|ControlMask, KEY, toggleview, {.ui = 1 << TAG} }, \ + { MODKEY|ShiftMask, KEY, tag, {.ui = 1 << TAG} }, \ + { MODKEY|ControlMask|ShiftMask, KEY, previewtag, {.ui = TAG } }, \ /* helper for spawning shell commands in the pre dwm-5.0 fashion */ #define SHCMD(cmd) { .v = (const char*[]){ "/bin/sh", "-c", cmd, NULL } } /* commands */ static char dmenumon[2] = "0"; /* component of dmenucmd, manipulated in spawn() */ -static const char *dmenucmd[] = { "dmenu_run", "-m", dmenumon, "-fn", dmenufont, "-nb", col_gray1, "-nf", col_gray3, "-sb", col_cyan, "-sf", col_gray4, NULL }; +static const char *dmenucmd[] = { "/home/augety/.dwm/menu.sh", NULL }; static const char *termcmd[] = { "st", NULL }; + static const char scratchpadname[] = "scratchpad"; static const char *scratchpadcmd[] = { "st", "-t", scratchpadname, "-g", "130x34", NULL }; +// 设置壁纸 +static const char *setupwallpaper[] = { "/home/augety/.dwm/wallpapers.sh", "setup", NULL }; + +// 截屏 +static const char *screenshot[] = { "/home/augety/.dwm/flameshot.sh", NULL }; + + static const Key keys[] = { - /* modifier key function argument */ - // rofi | dmenu - { MODKEY, XK_p, spawn, {.v = dmenucmd } }, - // 终端 - { MODKEY, XK_Return, spawn, {.v = termcmd } }, - // 浮动终端 - { MODKEY, XK_apostrophe, togglescratch, {.v = scratchpadcmd } }, - // 设置主窗口 - { MODKEY|ShiftMask, XK_Return, zoom, {0} }, - // 关闭 | 打开 状态栏 - { MODKEY, XK_b, togglebar, {0} }, - // 切换标签页 - { MODKEY, XK_Tab, view, {0} }, - // 关闭软件 - { MODKEY|ShiftMask, XK_q, killclient, {0} }, - // 关闭 DWM - { MODKEY|ShiftMask, XK_c, quit, {0} }, + /* modifier key function argument */ + // rofi | dmenu + { MODKEY, XK_p, spawn, {.v = dmenucmd } }, + // 终端 + { MODKEY, XK_Return, spawn, {.v = termcmd } }, + // 设置壁纸 + { MODKEY, XK_r, spawn, {.v = setupwallpaper} }, + // 截屏 + { MODKEY, XK_a, spawn, {.v = screenshot} }, + // 浮动终端 + { MODKEY, XK_apostrophe, togglescratch, {.v = scratchpadcmd } }, + // 设置主窗口 + { MODKEY|ShiftMask, XK_Return, zoom, {0} }, + // 关闭 | 打开 状态栏 + { MODKEY, XK_b, togglebar, {0} }, + // 切换标签页 + { MODKEY, XK_Tab, view, {0} }, + // 关闭软件 + { MODKEY|ShiftMask, XK_q, killclient, {0} }, + // 关闭 DWM + { MODKEY|ShiftMask, XK_c, quit, {0} }, + + { MODKEY, XK_j, focusstackvis, {.i = +1 } }, + { MODKEY, XK_k, focusstackvis, {.i = -1 } }, + { MODKEY|ShiftMask, XK_j, focusstackhid, {.i = +1 } }, + { MODKEY|ShiftMask, XK_k, focusstackhid, {.i = -1 } }, + { MODKEY, XK_s, show, {0} }, + { MODKEY|ShiftMask, XK_s, showall, {0} }, + { MODKEY, XK_h, hide, {0} }, - // awesomebar - { MODKEY, XK_j, focusstackvis, {.i = +1 } }, - { MODKEY, XK_k, focusstackvis, {.i = -1 } }, - { MODKEY|ShiftMask, XK_j, focusstackhid, {.i = +1 } }, - { MODKEY|ShiftMask, XK_k, focusstackhid, {.i = -1 } }, - { MODKEY, XK_s, show, {0} }, - { MODKEY|ShiftMask, XK_s, showall, {0} }, - { MODKEY, XK_h, hide, {0} }, + { MODKEY|ControlMask, XK_j, rotatestack, {.i = +1 } }, + { MODKEY|ControlMask, XK_k, rotatestack, {.i = -1 } }, - // Rotate stack - { MODKEY|ControlMask, XK_j, rotatestack, {.i = +1 } }, - { MODKEY|ControlMask, XK_k, rotatestack, {.i = -1 } }, + // 全屏 + { MODKEY|ShiftMask, XK_f, fullscreen, {0} }, + // 关闭间隙 + { MODKEY|Mod1Mask, XK_0, togglegaps, {0} }, - // 关闭间隙 - { MODKEY|Mod1Mask, XK_0, togglegaps, {0} }, - - { MODKEY, XK_i, incnmaster, {.i = +1 } }, - { MODKEY, XK_d, incnmaster, {.i = -1 } }, - { MODKEY, XK_h, setmfact, {.f = -0.05} }, - { MODKEY, XK_l, setmfact, {.f = +0.05} }, - - { MODKEY, XK_t, setlayout, {.v = &layouts[0]} }, - { MODKEY, XK_f, setlayout, {.v = &layouts[1]} }, - { MODKEY, XK_m, setlayout, {.v = &layouts[2]} }, - { MODKEY|ShiftMask, XK_f, fullscreen, {0} }, - { MODKEY, XK_space, setlayout, {0} }, - { MODKEY|ShiftMask, XK_space, togglefloating, {0} }, - { MODKEY, XK_0, view, {.ui = ~0 } }, - { MODKEY|ShiftMask, XK_0, tag, {.ui = ~0 } }, - { MODKEY, XK_comma, focusmon, {.i = -1 } }, - { MODKEY, XK_period, focusmon, {.i = +1 } }, - { MODKEY|ShiftMask, XK_comma, tagmon, {.i = -1 } }, - { MODKEY|ShiftMask, XK_period, tagmon, {.i = +1 } }, - { MODKEY, XK_s, show, {0} }, - { MODKEY|ShiftMask, XK_s, showall, {0} }, - { MODKEY, XK_h, hide, {0} }, - TAGKEYS( XK_1, 0) - TAGKEYS( XK_2, 1) - TAGKEYS( XK_3, 2) - TAGKEYS( XK_4, 3) - TAGKEYS( XK_5, 4) - TAGKEYS( XK_6, 5) - TAGKEYS( XK_7, 6) - TAGKEYS( XK_8, 7) - TAGKEYS( XK_9, 8) - + { MODKEY, XK_i, incnmaster, {.i = +1 } }, + { MODKEY, XK_d, incnmaster, {.i = -1 } }, + { MODKEY, XK_h, setmfact, {.f = -0.05} }, + { MODKEY, XK_l, setmfact, {.f = +0.05} }, + { MODKEY, XK_t, setlayout, {.v = &layouts[0]} }, + { MODKEY, XK_f, setlayout, {.v = &layouts[1]} }, + { MODKEY, XK_m, setlayout, {.v = &layouts[2]} }, + { MODKEY, XK_space, setlayout, {0} }, + { MODKEY|ShiftMask, XK_space, togglefloating, {0} }, + { MODKEY, XK_0, view, {.ui = ~0 } }, + { MODKEY|ShiftMask, XK_0, tag, {.ui = ~0 } }, + { MODKEY, XK_comma, focusmon, {.i = -1 } }, + { MODKEY, XK_period, focusmon, {.i = +1 } }, + { MODKEY|ShiftMask, XK_comma, tagmon, {.i = -1 } }, + { MODKEY|ShiftMask, XK_period, tagmon, {.i = +1 } }, + TAGKEYS( XK_1, 0) + TAGKEYS( XK_2, 1) + TAGKEYS( XK_3, 2) + TAGKEYS( XK_4, 3) + TAGKEYS( XK_5, 4) + TAGKEYS( XK_6, 5) + TAGKEYS( XK_7, 6) + TAGKEYS( XK_8, 7) + TAGKEYS( XK_9, 8) }; /* button definitions */ /* click can be ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle, ClkClientWin, or ClkRootWin */ static const Button buttons[] = { - /* click event mask button function argument */ - { ClkLtSymbol, 0, Button1, setlayout, {0} }, - { ClkLtSymbol, 0, Button3, setlayout, {.v = &layouts[2]} }, - { ClkWinTitle, 0, Button1, togglewin, {0} }, - { ClkWinTitle, 0, Button2, zoom, {0} }, - { ClkStatusText, 0, Button2, spawn, {.v = termcmd } }, - { ClkClientWin, MODKEY, Button1, movemouse, {0} }, - { ClkClientWin, MODKEY, Button2, togglefloating, {0} }, - { ClkClientWin, MODKEY, Button3, resizemouse, {0} }, - { ClkTagBar, 0, Button1, view, {0} }, - { ClkTagBar, 0, Button3, toggleview, {0} }, - { ClkTagBar, MODKEY, Button1, tag, {0} }, - { ClkTagBar, MODKEY, Button3, toggletag, {0} }, + /* click event mask button function argument */ + { ClkTagBar, MODKEY, Button1, tag, {0} }, + { ClkTagBar, MODKEY, Button3, toggletag, {0} }, + { ClkWinTitle, 0, Button1, togglewin, {0} }, + { ClkWinTitle, 0, Button2, zoom, {0} }, + { ClkStatusText, 0, Button2, spawn, {.v = termcmd } }, + { ClkClientWin, MODKEY, Button1, movemouse, {0} }, + { ClkClientWin, MODKEY, Button2, togglefloating, {0} }, + { ClkClientWin, MODKEY, Button3, resizemouse, {0} }, + { ClkTagBar, 0, Button1, view, {0} }, + { ClkTagBar, 0, Button3, toggleview, {0} }, + { ClkTagBar, MODKEY, Button1, tag, {0} }, + { ClkTagBar, MODKEY, Button3, toggletag, {0} }, }; diff --git a/dwm/config.mk b/dwm/config.mk index e175aeb..d793e2a 100644 --- a/dwm/config.mk +++ b/dwm/config.mk @@ -1,5 +1,5 @@ # dwm version -VERSION = 6.5 +VERSION = 6.4 # Customize below to fit your system diff --git a/dwm/desktop/dwm.desktop b/dwm/desktop/dwm.desktop new file mode 100644 index 0000000..43cab80 --- /dev/null +++ b/dwm/desktop/dwm.desktop @@ -0,0 +1,7 @@ +[Desktop Entry] +Encoding=UTF-8 +Name=Dwm +Comment=Dynamic window manager +Exec=dwm +Icon=dwm +Type=XSession \ No newline at end of file diff --git a/dwm/dwm.png b/dwm/desktop/dwm.png similarity index 100% rename from dwm/dwm.png rename to dwm/desktop/dwm.png diff --git a/dwm/dwm.c b/dwm/dwm.c index fd8d627..b769d7a 100644 --- a/dwm/dwm.c +++ b/dwm/dwm.c @@ -75,7 +75,7 @@ /* enums */ enum { CurNormal, CurResize, CurMove, CurLast }; /* cursor */ -enum { SchemeNorm, SchemeSel, SchemeHid }; /* color schemes */ +enum { SchemeNorm, SchemeSel, SchemeHov, SchemeHid }; /* color schemes */ enum { NetSupported, NetWMName, NetWMState, NetWMCheck, NetSystemTray, NetSystemTrayOP, NetSystemTrayOrientation, NetSystemTrayOrientationHorz, NetWMFullscreen, NetActiveWindow, NetWMWindowType, @@ -155,6 +155,7 @@ struct Monitor { int hidsel; Client *clients; Client *sel; + Client *hov; Client *stack; Monitor *next; Window barwin; @@ -257,10 +258,12 @@ static void show(const Arg *arg); static void showall(const Arg *arg); static void showwin(Client *c); static void showhide(Client *c); +static int solitary(Client *c); static void spawn(const Arg *arg); static Monitor *systraytomon(Monitor *m); static void tag(const Arg *arg); static void tagmon(const Arg *arg); +static void tile(Monitor *m); static void togglebar(const Arg *arg); static void togglefloating(const Arg *arg); static void togglescratch(const Arg *arg); @@ -297,9 +300,9 @@ static void takepreview(void); static void previewtag(const Arg *arg); /* variables */ +static Systray *systray = NULL; static const char autostartblocksh[] = "autostart_blocking.sh"; static const char autostartsh[] = "autostart.sh"; -static Systray *systray = NULL; static const char broken[] = "broken"; static const char dwmdir[] = "dwm"; static const char localshare[] = ".local/share"; @@ -339,6 +342,8 @@ static Window root, wmcheckwin; /* configuration, allows nested code to access above variables */ #include "config.h" +static unsigned int scratchtag = 1 << LENGTH(tags); + struct Pertag { unsigned int curtag, prevtag; /* current and previous tag */ int nmasters[LENGTH(tags) + 1]; /* number of windows in master area */ @@ -348,8 +353,6 @@ struct Pertag { int showbars[LENGTH(tags) + 1]; /* display bar for the current tag */ }; -static unsigned int scratchtag = 1 << LENGTH(tags); - /* compile-time check if all tags fit into an unsigned int bit array. */ struct NumTags { char limitexceeded[LENGTH(tags) > 31 ? -1 : 1]; }; @@ -514,7 +517,7 @@ buttonpress(XEvent *e) i = x = 0; unsigned int occ = 0; for(c = m->clients; c; c=c->next) - occ |= c->tags == TAGMASK ? 0 : c->tags; + occ |= c->tags; do { /* Do not reserve space for vacant tags */ if (!(occ & 1 << i || m->tagset[m->seltags] & 1 << i)) @@ -529,10 +532,10 @@ buttonpress(XEvent *e) selmon->previewshow = 0; XUnmapWindow(dpy, selmon->tagwin); } - } else if (ev->x < x + (int)TEXTW(selmon->ltsymbol) - getsystraywidth()) + } else if (ev->x < x + TEXTW(selmon->ltsymbol)) click = ClkLtSymbol; /* 2px right padding */ - else if (ev->x > selmon->ww - TEXTW(stext) + lrpad - 2) + else if (ev->x > selmon->ww - (int)TEXTW(stext) - getsystraywidth()) click = ClkStatusText; else { x += TEXTW(selmon->ltsymbol); @@ -912,7 +915,9 @@ drawbar(Monitor *m) resizebarwin(m); for (c = m->clients; c; c = c->next) { - occ |= c->tags == TAGMASK ? 0 : c->tags; + if (ISVISIBLE(c)) + n++; + occ |= c->tags; if (c->isurgent) urg |= c->tags; } @@ -937,7 +942,9 @@ drawbar(Monitor *m) for (c = m->clients; c; c = c->next) { if (!ISVISIBLE(c)) continue; - if (m->sel == c) + if (m->hov == c) + scm = SchemeHov; + else if (m->sel == c) scm = SchemeSel; else if (HIDDEN(c)) scm = SchemeHid; @@ -1050,7 +1057,11 @@ focus(Client *c) detachstack(c); attachstack(c); grabbuttons(c, 1); - XSetWindowBorder(dpy, c->win, scheme[SchemeSel][ColBorder].pixel); + /* Avoid flickering when another client appears and the border + * is restored */ + if (!solitary(c)) { + XSetWindowBorder(dpy, c->win, scheme[SchemeSel][ColBorder].pixel); + } setfocus(c); } else { XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime); @@ -1467,7 +1478,9 @@ monocle(Monitor *m) void motionnotify(XEvent *e) { + // int x, i; static Monitor *mon = NULL; + Client *c; Monitor *m; XMotionEvent *ev = &e->xmotion; unsigned int i, x; @@ -1501,14 +1514,70 @@ motionnotify(XEvent *e) XUnmapWindow(dpy, selmon->tagwin); } - if (ev->window != root) + if (ev->window != selmon->barwin) { + if (selmon->hov) { + if (selmon->hov != selmon->sel) + XSetWindowBorder(dpy, selmon->hov->win, scheme[SchemeNorm][ColBorder].pixel); + else + XSetWindowBorder(dpy, selmon->hov->win, scheme[SchemeSel][ColBorder].pixel); + + selmon->hov = NULL; + c = wintoclient(ev->window); + m = c ? c->mon : wintomon(ev->window); + drawbar(m); + } + + if (ev->window == root) { + if ((m = recttomon(ev->x_root, ev->y_root, 1, 1)) != mon && mon) { + unfocus(selmon->sel, 1); + selmon = m; + focus(NULL); + } + mon = m; + } + return; - if ((m = recttomon(ev->x_root, ev->y_root, 1, 1)) != mon && mon) { - unfocus(selmon->sel, 1); - selmon = m; - focus(NULL); } - mon = m; + + c = wintoclient(ev->window); + m = c ? c->mon : wintomon(ev->window); + c = m->clients; + + x = 0, i = 0; + do + x += TEXTW(tags[i]); + while (ev->x >= x && ++i < LENGTH(tags)); + if (i < LENGTH(tags) || ev->x < x + TEXTW(selmon->ltsymbol) || ev->x > selmon->ww - TEXTW(stext) + lrpad - 2) { + if (selmon->hov) { + if (selmon->hov != selmon->sel) + XSetWindowBorder(dpy, selmon->hov->win, scheme[SchemeNorm][ColBorder].pixel); + else + XSetWindowBorder(dpy, selmon->hov->win, scheme[SchemeSel][ColBorder].pixel); + selmon->hov = NULL; + drawbar(m); + } + } else { + x += TEXTW(selmon->ltsymbol); + if (c) { + do { + if (!ISVISIBLE(c)) + continue; + else + x +=(1.0 / (double)m->bt) * m->btw; + } while (ev->x > x && (c = c->next)); + if (c) { + if (selmon->hov) { + if (selmon->hov != selmon->sel) + XSetWindowBorder(dpy, selmon->hov->win, scheme[SchemeNorm][ColBorder].pixel); + else + XSetWindowBorder(dpy, selmon->hov->win, scheme[SchemeSel][ColBorder].pixel); + } + selmon->hov = c; + XSetWindowBorder(dpy, c->win, scheme[SchemeHov][ColBorder].pixel); + } + } + drawbar(m); + } } void @@ -1703,6 +1772,11 @@ resizeclient(Client *c, int x, int y, int w, int h) c->oldw = c->w; c->w = wc.width = w; c->oldh = c->h; c->h = wc.height = h; wc.border_width = c->bw; + if (solitary(c)) { + c->w = wc.width += c->bw * 2; + c->h = wc.height += c->bw * 2; + wc.border_width = 0; + } XConfigureWindow(dpy, c->win, CWX|CWY|CWWidth|CWHeight|CWBorderWidth, &wc); configure(c); XSync(dpy, False); @@ -2322,6 +2396,15 @@ showhide(Client *c) } } +int +solitary(Client *c) +{ + return ((nexttiled(c->mon->clients) == c && !nexttiled(c->next)) + || &monocle == c->mon->lt[c->mon->sellt]->arrange) + && !c->isfullscreen && !c->isfloating + && NULL != c->mon->lt[c->mon->sellt]->arrange; +} + void spawn(const Arg *arg) { @@ -2581,6 +2664,7 @@ updatebars(void) if (showsystray && m == systraytomon(m)) XMapRaised(dpy, systray->win); XMapRaised(dpy, m->barwin); + XSelectInput(dpy, m->barwin, ButtonPressMask|PointerMotionMask); XSetClassHint(dpy, m->barwin, &ch); } } @@ -2599,7 +2683,7 @@ updatebarpos(Monitor *m) } void -updateclientlist(void) +updateclientlist() { Client *c; Monitor *m; diff --git a/dwm/patches/dwm-awesomebar-20230431-6.4.diff b/dwm/patches/dwm-awesomebarwithhover-20230431-6.4.diff similarity index 76% rename from dwm/patches/dwm-awesomebar-20230431-6.4.diff rename to dwm/patches/dwm-awesomebarwithhover-20230431-6.4.diff index 6ef4ee2..5fea2f3 100644 --- a/dwm/patches/dwm-awesomebar-20230431-6.4.diff +++ b/dwm/patches/dwm-awesomebarwithhover-20230431-6.4.diff @@ -1,16 +1,17 @@ diff --git a/config.def.h b/config.def.h -index 061ad66..05f18e5 100644 +index 061ad66..82a3ed2 100644 --- a/config.def.h +++ b/config.def.h -@@ -16,6 +16,7 @@ static const char *colors[][3] = { +@@ -16,6 +16,8 @@ static const char *colors[][3] = { /* fg bg border */ [SchemeNorm] = { col_gray3, col_gray1, col_gray2 }, [SchemeSel] = { col_gray4, col_cyan, col_cyan }, ++ [SchemeHov] = { col_gray4, col_cyan, col_cyan }, + [SchemeHid] = { col_cyan, col_gray1, col_cyan }, }; /* tagging */ -@@ -64,8 +65,10 @@ static const Key keys[] = { +@@ -64,8 +66,10 @@ static const Key keys[] = { { MODKEY, XK_p, spawn, {.v = dmenucmd } }, { MODKEY|ShiftMask, XK_Return, spawn, {.v = termcmd } }, { MODKEY, XK_b, togglebar, {0} }, @@ -23,7 +24,7 @@ index 061ad66..05f18e5 100644 { MODKEY, XK_i, incnmaster, {.i = +1 } }, { MODKEY, XK_d, incnmaster, {.i = -1 } }, { MODKEY, XK_h, setmfact, {.f = -0.05} }, -@@ -84,6 +87,9 @@ static const Key keys[] = { +@@ -84,6 +88,9 @@ static const Key keys[] = { { MODKEY, XK_period, focusmon, {.i = +1 } }, { MODKEY|ShiftMask, XK_comma, tagmon, {.i = -1 } }, { MODKEY|ShiftMask, XK_period, tagmon, {.i = +1 } }, @@ -33,7 +34,7 @@ index 061ad66..05f18e5 100644 TAGKEYS( XK_1, 0) TAGKEYS( XK_2, 1) TAGKEYS( XK_3, 2) -@@ -102,6 +108,7 @@ static const Button buttons[] = { +@@ -102,6 +109,7 @@ static const Button buttons[] = { /* click event mask button function argument */ { ClkLtSymbol, 0, Button1, setlayout, {0} }, { ClkLtSymbol, 0, Button3, setlayout, {.v = &layouts[2]} }, @@ -42,7 +43,7 @@ index 061ad66..05f18e5 100644 { ClkStatusText, 0, Button2, spawn, {.v = termcmd } }, { ClkClientWin, MODKEY, Button1, movemouse, {0} }, diff --git a/dwm.c b/dwm.c -index e5efb6a..0d18e1b 100644 +index e5efb6a..8cb5171 100644 --- a/dwm.c +++ b/dwm.c @@ -50,6 +50,7 @@ @@ -58,7 +59,7 @@ index e5efb6a..0d18e1b 100644 /* enums */ enum { CurNormal, CurResize, CurMove, CurLast }; /* cursor */ -enum { SchemeNorm, SchemeSel }; /* color schemes */ -+enum { SchemeNorm, SchemeSel, SchemeHid }; /* color schemes */ ++enum { SchemeNorm, SchemeSel, SchemeHov, SchemeHid }; /* color schemes */ enum { NetSupported, NetWMName, NetWMState, NetWMCheck, NetWMFullscreen, NetActiveWindow, NetWMWindowType, NetWMWindowTypeDialog, NetClientList, NetLast }; /* EWMH atoms */ @@ -71,15 +72,18 @@ index e5efb6a..0d18e1b 100644 int mx, my, mw, mh; /* screen size */ int wx, wy, ww, wh; /* window area */ unsigned int seltags; -@@ -124,6 +127,7 @@ struct Monitor { +@@ -124,8 +127,10 @@ struct Monitor { unsigned int tagset[2]; int showbar; int topbar; + int hidsel; Client *clients; Client *sel; ++ Client *hov; Client *stack; -@@ -168,13 +172,17 @@ static void expose(XEvent *e); + Monitor *next; + Window barwin; +@@ -168,13 +173,17 @@ static void expose(XEvent *e); static void focus(Client *c); static void focusin(XEvent *e); static void focusmon(const Arg *arg); @@ -98,7 +102,7 @@ index e5efb6a..0d18e1b 100644 static void incnmaster(const Arg *arg); static void keypress(XEvent *e); static void killclient(const Arg *arg); -@@ -204,6 +212,9 @@ static void setlayout(const Arg *arg); +@@ -204,6 +213,9 @@ static void setlayout(const Arg *arg); static void setmfact(const Arg *arg); static void setup(void); static void seturgent(Client *c, int urg); @@ -108,7 +112,7 @@ index e5efb6a..0d18e1b 100644 static void showhide(Client *c); static void sigchld(int unused); static void spawn(const Arg *arg); -@@ -214,6 +225,7 @@ static void togglebar(const Arg *arg); +@@ -214,6 +226,7 @@ static void togglebar(const Arg *arg); static void togglefloating(const Arg *arg); static void toggletag(const Arg *arg); static void toggleview(const Arg *arg); @@ -116,7 +120,7 @@ index e5efb6a..0d18e1b 100644 static void unfocus(Client *c, int setfocus); static void unmanage(Client *c, int destroyed); static void unmapnotify(XEvent *e); -@@ -442,10 +454,25 @@ buttonpress(XEvent *e) +@@ -442,10 +455,25 @@ buttonpress(XEvent *e) arg.ui = 1 << i; } else if (ev->x < x + TEXTW(selmon->ltsymbol)) click = ClkLtSymbol; @@ -145,7 +149,7 @@ index e5efb6a..0d18e1b 100644 } else if ((c = wintoclient(ev->window))) { focus(c); restack(selmon); -@@ -455,7 +482,7 @@ buttonpress(XEvent *e) +@@ -455,7 +483,7 @@ buttonpress(XEvent *e) for (i = 0; i < LENGTH(buttons); i++) if (click == buttons[i].click && buttons[i].func && buttons[i].button == ev->button && CLEANMASK(buttons[i].mask) == CLEANMASK(ev->state)) @@ -154,7 +158,7 @@ index e5efb6a..0d18e1b 100644 } void -@@ -699,7 +726,7 @@ dirtomon(int dir) +@@ -699,7 +727,7 @@ dirtomon(int dir) void drawbar(Monitor *m) { @@ -163,7 +167,7 @@ index e5efb6a..0d18e1b 100644 int boxs = drw->fonts->h / 9; int boxw = drw->fonts->h / 6 + 2; unsigned int i, occ = 0, urg = 0; -@@ -716,6 +743,8 @@ drawbar(Monitor *m) +@@ -716,6 +744,8 @@ drawbar(Monitor *m) } for (c = m->clients; c; c = c->next) { @@ -172,7 +176,7 @@ index e5efb6a..0d18e1b 100644 occ |= c->tags; if (c->isurgent) urg |= c->tags; -@@ -736,16 +765,36 @@ drawbar(Monitor *m) +@@ -736,16 +766,38 @@ drawbar(Monitor *m) x = drw_text(drw, x, 0, w, bh, lrpad / 2, m->ltsymbol, 0); if ((w = m->ww - tw - x) > bh) { @@ -187,7 +191,9 @@ index e5efb6a..0d18e1b 100644 + for (c = m->clients; c; c = c->next) { + if (!ISVISIBLE(c)) + continue; -+ if (m->sel == c) ++ if (m->hov == c) ++ scm = SchemeHov; ++ else if (m->sel == c) + scm = SchemeSel; + else if (HIDDEN(c)) + scm = SchemeHid; @@ -214,7 +220,7 @@ index e5efb6a..0d18e1b 100644 drw_map(drw, m->barwin, 0, 0, m->ww, bh); } -@@ -791,9 +840,17 @@ void +@@ -791,9 +843,17 @@ void focus(Client *c) { if (!c || !ISVISIBLE(c)) @@ -234,7 +240,7 @@ index e5efb6a..0d18e1b 100644 if (c) { if (c->mon != selmon) selmon = c->mon; -@@ -837,28 +894,52 @@ focusmon(const Arg *arg) +@@ -837,28 +897,52 @@ focusmon(const Arg *arg) } void @@ -256,11 +262,11 @@ index e5efb6a..0d18e1b 100644 - if (!selmon->sel || (selmon->sel->isfullscreen && lockfullscreen)) + // if no client selected AND exclude hidden client; if client selected but fullscreened + if ((!selmon->sel && !hid) || (selmon->sel && selmon->sel->isfullscreen && lockfullscreen)) ++ return; ++ if (!selmon->clients) return; - if (arg->i > 0) { - for (c = selmon->sel->next; c && !ISVISIBLE(c); c = c->next); -+ if (!selmon->clients) -+ return; + if (inc > 0) { + if (selmon->sel) + for (c = selmon->sel->next; @@ -297,7 +303,7 @@ index e5efb6a..0d18e1b 100644 } } -@@ -968,6 +1049,36 @@ grabkeys(void) +@@ -968,6 +1052,36 @@ grabkeys(void) } } @@ -334,7 +340,7 @@ index e5efb6a..0d18e1b 100644 void incnmaster(const Arg *arg) { -@@ -1070,12 +1181,14 @@ manage(Window w, XWindowAttributes *wa) +@@ -1070,12 +1184,14 @@ manage(Window w, XWindowAttributes *wa) XChangeProperty(dpy, root, netatom[NetClientList], XA_WINDOW, 32, PropModeAppend, (unsigned char *) &(c->win), 1); XMoveResizeWindow(dpy, c->win, c->x + 2 * sw, c->y, c->w, c->h); /* some windows require this */ @@ -351,7 +357,90 @@ index e5efb6a..0d18e1b 100644 focus(NULL); } -@@ -1196,7 +1309,7 @@ movemouse(const Arg *arg) +@@ -1119,18 +1235,76 @@ monocle(Monitor *m) + void + motionnotify(XEvent *e) + { ++ int x, i; + static Monitor *mon = NULL; ++ Client *c; + Monitor *m; + XMotionEvent *ev = &e->xmotion; + +- if (ev->window != root) ++ if (ev->window != selmon->barwin) { ++ if (selmon->hov) { ++ if (selmon->hov != selmon->sel) ++ XSetWindowBorder(dpy, selmon->hov->win, scheme[SchemeNorm][ColBorder].pixel); ++ else ++ XSetWindowBorder(dpy, selmon->hov->win, scheme[SchemeSel][ColBorder].pixel); ++ ++ selmon->hov = NULL; ++ c = wintoclient(ev->window); ++ m = c ? c->mon : wintomon(ev->window); ++ drawbar(m); ++ } ++ ++ if (ev->window == root) { ++ if ((m = recttomon(ev->x_root, ev->y_root, 1, 1)) != mon && mon) { ++ unfocus(selmon->sel, 1); ++ selmon = m; ++ focus(NULL); ++ } ++ mon = m; ++ } ++ + return; +- if ((m = recttomon(ev->x_root, ev->y_root, 1, 1)) != mon && mon) { +- unfocus(selmon->sel, 1); +- selmon = m; +- focus(NULL); + } +- mon = m; ++ ++ c = wintoclient(ev->window); ++ m = c ? c->mon : wintomon(ev->window); ++ c = m->clients; ++ ++ x = 0, i = 0; ++ do ++ x += TEXTW(tags[i]); ++ while (ev->x >= x && ++i < LENGTH(tags)); ++ if (i < LENGTH(tags) || ev->x < x + TEXTW(selmon->ltsymbol) || ev->x > selmon->ww - TEXTW(stext) + lrpad - 2) { ++ if (selmon->hov) { ++ if (selmon->hov != selmon->sel) ++ XSetWindowBorder(dpy, selmon->hov->win, scheme[SchemeNorm][ColBorder].pixel); ++ else ++ XSetWindowBorder(dpy, selmon->hov->win, scheme[SchemeSel][ColBorder].pixel); ++ selmon->hov = NULL; ++ drawbar(m); ++ } ++ } else { ++ x += TEXTW(selmon->ltsymbol); ++ if (c) { ++ do { ++ if (!ISVISIBLE(c)) ++ continue; ++ else ++ x +=(1.0 / (double)m->bt) * m->btw; ++ } while (ev->x > x && (c = c->next)); ++ if (c) { ++ if (selmon->hov) { ++ if (selmon->hov != selmon->sel) ++ XSetWindowBorder(dpy, selmon->hov->win, scheme[SchemeNorm][ColBorder].pixel); ++ else ++ XSetWindowBorder(dpy, selmon->hov->win, scheme[SchemeSel][ColBorder].pixel); ++ } ++ selmon->hov = c; ++ XSetWindowBorder(dpy, c->win, scheme[SchemeHov][ColBorder].pixel); ++ } ++ } ++ drawbar(m); ++ } + } + + void +@@ -1196,7 +1370,7 @@ movemouse(const Arg *arg) Client * nexttiled(Client *c) { @@ -360,7 +449,7 @@ index e5efb6a..0d18e1b 100644 return c; } -@@ -1249,6 +1362,16 @@ propertynotify(XEvent *e) +@@ -1249,6 +1423,16 @@ propertynotify(XEvent *e) void quit(const Arg *arg) { @@ -377,7 +466,7 @@ index e5efb6a..0d18e1b 100644 running = 0; } -@@ -1610,6 +1733,42 @@ seturgent(Client *c, int urg) +@@ -1610,6 +1794,42 @@ seturgent(Client *c, int urg) XFree(wmh); } @@ -420,7 +509,7 @@ index e5efb6a..0d18e1b 100644 void showhide(Client *c) { -@@ -1744,6 +1903,23 @@ toggleview(const Arg *arg) +@@ -1744,6 +1964,23 @@ toggleview(const Arg *arg) } } @@ -444,3 +533,11 @@ index e5efb6a..0d18e1b 100644 void unfocus(Client *c, int setfocus) { +@@ -1815,6 +2052,7 @@ updatebars(void) + CWOverrideRedirect|CWBackPixmap|CWEventMask, &wa); + XDefineCursor(dpy, m->barwin, cursor[CurNormal]->cursor); + XMapRaised(dpy, m->barwin); ++ XSelectInput(dpy, m->barwin, ButtonPressMask|PointerMotionMask); + XSetClassHint(dpy, m->barwin, &ch); + } + } diff --git a/dwm/patches/dwm-hide_vacant_tags-6.4.diff b/dwm/patches/dwm-hide_vacant_tags-6.3.diff similarity index 72% rename from dwm/patches/dwm-hide_vacant_tags-6.4.diff rename to dwm/patches/dwm-hide_vacant_tags-6.3.diff index 42d9c05..0ccc7fc 100644 --- a/dwm/patches/dwm-hide_vacant_tags-6.4.diff +++ b/dwm/patches/dwm-hide_vacant_tags-6.3.diff @@ -1,17 +1,15 @@ -:100644 100644 f1d86b2 0000000 M dwm.c - diff --git a/dwm.c b/dwm.c -index f1d86b2..d41cc14 100644 +index a96f33c..f2da729 100644 --- a/dwm.c +++ b/dwm.c -@@ -433,9 +433,15 @@ buttonpress(XEvent *e) +@@ -432,9 +432,15 @@ buttonpress(XEvent *e) } if (ev->window == selmon->barwin) { i = x = 0; - do + unsigned int occ = 0; + for(c = m->clients; c; c=c->next) -+ occ |= c->tags == TAGMASK ? 0 : c->tags; ++ occ |= c->tags; + do { + /* Do not reserve space for vacant tags */ + if (!(occ & 1 << i || m->tagset[m->seltags] & 1 << i)) @@ -22,14 +20,7 @@ index f1d86b2..d41cc14 100644 if (i < LENGTH(tags)) { click = ClkTagBar; arg.ui = 1 << i; -@@ -715,19 +721,18 @@ drawbar(Monitor *m) - } - - for (c = m->clients; c; c = c->next) { -- occ |= c->tags; -+ occ |= c->tags == TAGMASK ? 0 : c->tags; - if (c->isurgent) - urg |= c->tags; +@@ -719,13 +725,12 @@ drawbar(Monitor *m) } x = 0; for (i = 0; i < LENGTH(tags); i++) { @@ -45,4 +36,4 @@ index f1d86b2..d41cc14 100644 - urg & 1 << i); x += w; } - w = TEXTW(m->ltsymbol); + w = blw = TEXTW(m->ltsymbol); diff --git a/dwm/patches/dwm-noborderselflickerfix-2022042627-d93ff48803f0.diff b/dwm/patches/dwm-noborderselflickerfix-2022042627-d93ff48803f0.diff new file mode 100644 index 0000000..5a82b33 --- /dev/null +++ b/dwm/patches/dwm-noborderselflickerfix-2022042627-d93ff48803f0.diff @@ -0,0 +1,53 @@ +diff --git dwm.c dwm.c +index 0fc328a..4a767bd 100644 +--- dwm.c ++++ dwm.c +@@ -206,6 +206,7 @@ static void setup(void); + static void seturgent(Client *c, int urg); + static void showhide(Client *c); + static void sigchld(int unused); ++static int solitary(Client *c); + static void spawn(const Arg *arg); + static void tag(const Arg *arg); + static void tagmon(const Arg *arg); +@@ -802,7 +803,11 @@ focus(Client *c) + detachstack(c); + attachstack(c); + grabbuttons(c, 1); +- XSetWindowBorder(dpy, c->win, scheme[SchemeSel][ColBorder].pixel); ++ /* Avoid flickering when another client appears and the border ++ * is restored */ ++ if (!solitary(c)) { ++ XSetWindowBorder(dpy, c->win, scheme[SchemeSel][ColBorder].pixel); ++ } + setfocus(c); + } else { + XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime); +@@ -1288,6 +1293,11 @@ resizeclient(Client *c, int x, int y, int w, int h) + c->oldw = c->w; c->w = wc.width = w; + c->oldh = c->h; c->h = wc.height = h; + wc.border_width = c->bw; ++ if (solitary(c)) { ++ c->w = wc.width += c->bw * 2; ++ c->h = wc.height += c->bw * 2; ++ wc.border_width = 0; ++ } + XConfigureWindow(dpy, c->win, CWX|CWY|CWWidth|CWHeight|CWBorderWidth, &wc); + configure(c); + XSync(dpy, False); +@@ -1642,6 +1652,15 @@ sigchld(int unused) + while (0 < waitpid(-1, NULL, WNOHANG)); + } + ++int ++solitary(Client *c) ++{ ++ return ((nexttiled(c->mon->clients) == c && !nexttiled(c->next)) ++ || &monocle == c->mon->lt[c->mon->sellt]->arrange) ++ && !c->isfullscreen && !c->isfloating ++ && NULL != c->mon->lt[c->mon->sellt]->arrange; ++} ++ + void + spawn(const Arg *arg) + { diff --git a/dwm/patches/dwm-scratchpad-20240321-061e9fe.diff b/dwm/patches/dwm-scratchpad-20221102-ba56fe9.diff similarity index 83% rename from dwm/patches/dwm-scratchpad-20240321-061e9fe.diff rename to dwm/patches/dwm-scratchpad-20221102-ba56fe9.diff index cb218b6..804e112 100644 --- a/dwm/patches/dwm-scratchpad-20240321-061e9fe.diff +++ b/dwm/patches/dwm-scratchpad-20221102-ba56fe9.diff @@ -1,13 +1,3 @@ -From b9f3c11c3150f0b5d5b297a4eeeb2012764c98f5 Mon Sep 17 00:00:00 2001 -From: visil -Date: Thu, 21 Mar 2024 15:16:39 +0300 -Subject: [PATCH] Patch updated to 6.5 - ---- - config.def.h | 3 +++ - dwm.c | 34 ++++++++++++++++++++++++++++++++++ - 2 files changed, 37 insertions(+) - diff --git a/config.def.h b/config.def.h index 9efa774..0b8b310 100644 --- a/config.def.h @@ -28,10 +18,10 @@ index 9efa774..0b8b310 100644 { MODKEY, XK_j, focusstack, {.i = +1 } }, { MODKEY, XK_k, focusstack, {.i = -1 } }, diff --git a/dwm.c b/dwm.c -index f1d86b2..a8db21a 100644 +index 253aba7..4abf8d3 100644 --- a/dwm.c +++ b/dwm.c -@@ -211,6 +211,7 @@ static void tagmon(const Arg *arg); +@@ -212,6 +212,7 @@ static void tagmon(const Arg *arg); static void tile(Monitor *m); static void togglebar(const Arg *arg); static void togglefloating(const Arg *arg); @@ -39,7 +29,7 @@ index f1d86b2..a8db21a 100644 static void toggletag(const Arg *arg); static void toggleview(const Arg *arg); static void unfocus(Client *c, int setfocus); -@@ -271,6 +272,8 @@ static Window root, wmcheckwin; +@@ -272,6 +273,8 @@ static Window root, wmcheckwin; /* configuration, allows nested code to access above variables */ #include "config.h" @@ -48,7 +38,7 @@ index f1d86b2..a8db21a 100644 /* compile-time check if all tags fit into an unsigned int bit array. */ struct NumTags { char limitexceeded[LENGTH(tags) > 31 ? -1 : 1]; }; -@@ -1061,6 +1064,14 @@ manage(Window w, XWindowAttributes *wa) +@@ -1052,6 +1055,14 @@ manage(Window w, XWindowAttributes *wa) c->y = MAX(c->y, c->mon->wy); c->bw = borderpx; @@ -63,15 +53,15 @@ index f1d86b2..a8db21a 100644 wc.border_width = c->bw; XConfigureWindow(dpy, w, CWBorderWidth, &wc); XSetWindowBorder(dpy, w, scheme[SchemeNorm][ColBorder].pixel); -@@ -1651,6 +1662,7 @@ spawn(const Arg *arg) - +@@ -1641,6 +1652,7 @@ spawn(const Arg *arg) + { if (arg->v == dmenucmd) dmenumon[0] = '0' + selmon->num; + selmon->tagset[selmon->seltags] &= ~scratchtag; if (fork() == 0) { if (dpy) close(ConnectionNumber(dpy)); -@@ -1735,6 +1747,28 @@ togglefloating(const Arg *arg) +@@ -1719,6 +1731,28 @@ togglefloating(const Arg *arg) arrange(selmon); } @@ -100,6 +90,3 @@ index f1d86b2..a8db21a 100644 void toggletag(const Arg *arg) { --- -2.44.0 - diff --git a/dwm/patches/dwm-systray-20230922-9f88553.diff b/dwm/patches/dwm-systray-6.4.diff similarity index 90% rename from dwm/patches/dwm-systray-20230922-9f88553.diff rename to dwm/patches/dwm-systray-6.4.diff index 9356ec1..58e4a69 100644 --- a/dwm/patches/dwm-systray-20230922-9f88553.diff +++ b/dwm/patches/dwm-systray-6.4.diff @@ -1,5 +1,5 @@ diff --git a/config.def.h b/config.def.h -index 9efa774..fed4fb9 100644 +index 9efa774..750529d 100644 --- a/config.def.h +++ b/config.def.h @@ -3,6 +3,11 @@ @@ -14,8 +14,19 @@ index 9efa774..fed4fb9 100644 static const int showbar = 1; /* 0 means no bar */ static const int topbar = 1; /* 0 means bottom bar */ static const char *fonts[] = { "monospace:size=10" }; +@@ -101,8 +106,8 @@ static const Key keys[] = { + /* click can be ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle, ClkClientWin, or ClkRootWin */ + static const Button buttons[] = { + /* click event mask button function argument */ +- { ClkLtSymbol, 0, Button1, setlayout, {0} }, +- { ClkLtSymbol, 0, Button3, setlayout, {.v = &layouts[2]} }, ++ { ClkTagBar, MODKEY, Button1, tag, {0} }, ++ { ClkTagBar, MODKEY, Button3, toggletag, {0} }, + { ClkWinTitle, 0, Button2, zoom, {0} }, + { ClkStatusText, 0, Button2, spawn, {.v = termcmd } }, + { ClkClientWin, MODKEY, Button1, movemouse, {0} }, diff --git a/dwm.c b/dwm.c -index f1d86b2..f9e7e4a 100644 +index 03baf42..4611a03 100644 --- a/dwm.c +++ b/dwm.c @@ -57,12 +57,27 @@ @@ -85,15 +96,15 @@ index f1d86b2..f9e7e4a 100644 static void sendmon(Client *c, Monitor *m); static void setclientstate(Client *c, long state); static void setfocus(Client *c); -@@ -206,6 +231,7 @@ static void setup(void); - static void seturgent(Client *c, int urg); +@@ -207,6 +232,7 @@ static void seturgent(Client *c, int urg); static void showhide(Client *c); + static void sigchld(int unused); static void spawn(const Arg *arg); +static Monitor *systraytomon(Monitor *m); static void tag(const Arg *arg); static void tagmon(const Arg *arg); static void tile(Monitor *m); -@@ -223,18 +249,23 @@ static int updategeom(void); +@@ -224,18 +250,23 @@ static int updategeom(void); static void updatenumlockmask(void); static void updatesizehints(Client *c); static void updatestatus(void); @@ -117,7 +128,7 @@ index f1d86b2..f9e7e4a 100644 static const char broken[] = "broken"; static char stext[256]; static int screen; -@@ -257,9 +288,10 @@ static void (*handler[LASTEvent]) (XEvent *) = { +@@ -258,9 +289,10 @@ static void (*handler[LASTEvent]) (XEvent *) = { [MapRequest] = maprequest, [MotionNotify] = motionnotify, [PropertyNotify] = propertynotify, @@ -129,7 +140,7 @@ index f1d86b2..f9e7e4a 100644 static int running = 1; static Cur *cursor[CurLast]; static Clr **scheme; -@@ -441,7 +473,7 @@ buttonpress(XEvent *e) +@@ -442,7 +474,7 @@ buttonpress(XEvent *e) arg.ui = 1 << i; } else if (ev->x < x + TEXTW(selmon->ltsymbol)) click = ClkLtSymbol; @@ -138,7 +149,7 @@ index f1d86b2..f9e7e4a 100644 click = ClkStatusText; else click = ClkWinTitle; -@@ -484,6 +516,13 @@ cleanup(void) +@@ -485,6 +517,13 @@ cleanup(void) XUngrabKey(dpy, AnyKey, AnyModifier, root); while (mons) cleanupmon(mons); @@ -152,7 +163,7 @@ index f1d86b2..f9e7e4a 100644 for (i = 0; i < CurLast; i++) drw_cur_free(drw, cursor[i]); for (i = 0; i < LENGTH(colors); i++) -@@ -515,9 +554,58 @@ cleanupmon(Monitor *mon) +@@ -516,9 +555,58 @@ cleanupmon(Monitor *mon) void clientmessage(XEvent *e) { @@ -211,7 +222,7 @@ index f1d86b2..f9e7e4a 100644 if (!c) return; if (cme->message_type == netatom[NetWMState]) { -@@ -570,7 +658,7 @@ configurenotify(XEvent *e) +@@ -571,7 +659,7 @@ configurenotify(XEvent *e) for (c = m->clients; c; c = c->next) if (c->isfullscreen) resizeclient(c, m->mx, m->my, m->mw, m->mh); @@ -220,7 +231,7 @@ index f1d86b2..f9e7e4a 100644 } focus(NULL); arrange(NULL); -@@ -655,6 +743,11 @@ destroynotify(XEvent *e) +@@ -656,6 +744,11 @@ destroynotify(XEvent *e) if ((c = wintoclient(ev->window))) unmanage(c, 1); @@ -232,7 +243,7 @@ index f1d86b2..f9e7e4a 100644 } void -@@ -698,7 +791,7 @@ dirtomon(int dir) +@@ -699,7 +792,7 @@ dirtomon(int dir) void drawbar(Monitor *m) { @@ -241,7 +252,7 @@ index f1d86b2..f9e7e4a 100644 int boxs = drw->fonts->h / 9; int boxw = drw->fonts->h / 6 + 2; unsigned int i, occ = 0, urg = 0; -@@ -707,13 +800,17 @@ drawbar(Monitor *m) +@@ -708,13 +801,17 @@ drawbar(Monitor *m) if (!m->showbar) return; @@ -261,7 +272,7 @@ index f1d86b2..f9e7e4a 100644 for (c = m->clients; c; c = c->next) { occ |= c->tags; if (c->isurgent) -@@ -734,7 +831,7 @@ drawbar(Monitor *m) +@@ -735,7 +832,7 @@ drawbar(Monitor *m) drw_setscheme(drw, scheme[SchemeNorm]); x = drw_text(drw, x, 0, w, bh, lrpad / 2, m->ltsymbol, 0); @@ -270,7 +281,7 @@ index f1d86b2..f9e7e4a 100644 if (m->sel) { drw_setscheme(drw, scheme[m == selmon ? SchemeSel : SchemeNorm]); drw_text(drw, x, 0, w, bh, lrpad / 2, m->sel->name, 0); -@@ -745,7 +842,7 @@ drawbar(Monitor *m) +@@ -746,7 +843,7 @@ drawbar(Monitor *m) drw_rect(drw, x, 0, w, bh, 1, 1); } } @@ -279,7 +290,7 @@ index f1d86b2..f9e7e4a 100644 } void -@@ -782,8 +879,11 @@ expose(XEvent *e) +@@ -783,8 +880,11 @@ expose(XEvent *e) Monitor *m; XExposeEvent *ev = &e->xexpose; @@ -292,7 +303,7 @@ index f1d86b2..f9e7e4a 100644 } void -@@ -869,14 +969,32 @@ getatomprop(Client *c, Atom prop) +@@ -870,14 +970,32 @@ getatomprop(Client *c, Atom prop) unsigned char *p = NULL; Atom da, atom = None; @@ -326,7 +337,7 @@ index f1d86b2..f9e7e4a 100644 int getrootptr(int *x, int *y) { -@@ -1017,7 +1135,8 @@ killclient(const Arg *arg) +@@ -1018,7 +1136,8 @@ killclient(const Arg *arg) { if (!selmon->sel) return; @@ -336,7 +347,7 @@ index f1d86b2..f9e7e4a 100644 XGrabServer(dpy); XSetErrorHandler(xerrordummy); XSetCloseDownMode(dpy, DestroyAll); -@@ -1104,6 +1223,13 @@ maprequest(XEvent *e) +@@ -1105,6 +1224,13 @@ maprequest(XEvent *e) static XWindowAttributes wa; XMapRequestEvent *ev = &e->xmaprequest; @@ -350,7 +361,7 @@ index f1d86b2..f9e7e4a 100644 if (!XGetWindowAttributes(dpy, ev->window, &wa) || wa.override_redirect) return; if (!wintoclient(ev->window)) -@@ -1225,6 +1351,17 @@ propertynotify(XEvent *e) +@@ -1226,6 +1352,17 @@ propertynotify(XEvent *e) Window trans; XPropertyEvent *ev = &e->xproperty; @@ -368,7 +379,7 @@ index f1d86b2..f9e7e4a 100644 if ((ev->window == root) && (ev->atom == XA_WM_NAME)) updatestatus(); else if (ev->state == PropertyDelete) -@@ -1275,6 +1412,19 @@ recttomon(int x, int y, int w, int h) +@@ -1276,6 +1413,19 @@ recttomon(int x, int y, int w, int h) return r; } @@ -388,7 +399,7 @@ index f1d86b2..f9e7e4a 100644 void resize(Client *c, int x, int y, int w, int h, int interact) { -@@ -1282,6 +1432,14 @@ resize(Client *c, int x, int y, int w, int h, int interact) +@@ -1283,6 +1433,14 @@ resize(Client *c, int x, int y, int w, int h, int interact) resizeclient(c, x, y, w, h); } @@ -403,7 +414,7 @@ index f1d86b2..f9e7e4a 100644 void resizeclient(Client *c, int x, int y, int w, int h) { -@@ -1297,6 +1455,19 @@ resizeclient(Client *c, int x, int y, int w, int h) +@@ -1298,6 +1456,19 @@ resizeclient(Client *c, int x, int y, int w, int h) XSync(dpy, False); } @@ -423,7 +434,7 @@ index f1d86b2..f9e7e4a 100644 void resizemouse(const Arg *arg) { -@@ -1443,26 +1614,37 @@ setclientstate(Client *c, long state) +@@ -1444,26 +1615,37 @@ setclientstate(Client *c, long state) } int @@ -472,7 +483,7 @@ index f1d86b2..f9e7e4a 100644 } return exists; } -@@ -1476,7 +1658,7 @@ setfocus(Client *c) +@@ -1477,7 +1659,7 @@ setfocus(Client *c) XA_WINDOW, 32, PropModeReplace, (unsigned char *) &(c->win), 1); } @@ -481,7 +492,7 @@ index f1d86b2..f9e7e4a 100644 } void -@@ -1572,6 +1754,10 @@ setup(void) +@@ -1566,6 +1748,10 @@ setup(void) wmatom[WMTakeFocus] = XInternAtom(dpy, "WM_TAKE_FOCUS", False); netatom[NetActiveWindow] = XInternAtom(dpy, "_NET_ACTIVE_WINDOW", False); netatom[NetSupported] = XInternAtom(dpy, "_NET_SUPPORTED", False); @@ -492,7 +503,7 @@ index f1d86b2..f9e7e4a 100644 netatom[NetWMName] = XInternAtom(dpy, "_NET_WM_NAME", False); netatom[NetWMState] = XInternAtom(dpy, "_NET_WM_STATE", False); netatom[NetWMCheck] = XInternAtom(dpy, "_NET_SUPPORTING_WM_CHECK", False); -@@ -1579,6 +1765,9 @@ setup(void) +@@ -1573,6 +1759,9 @@ setup(void) netatom[NetWMWindowType] = XInternAtom(dpy, "_NET_WM_WINDOW_TYPE", False); netatom[NetWMWindowTypeDialog] = XInternAtom(dpy, "_NET_WM_WINDOW_TYPE_DIALOG", False); netatom[NetClientList] = XInternAtom(dpy, "_NET_CLIENT_LIST", False); @@ -502,7 +513,7 @@ index f1d86b2..f9e7e4a 100644 /* init cursors */ cursor[CurNormal] = drw_cur_create(drw, XC_left_ptr); cursor[CurResize] = drw_cur_create(drw, XC_sizing); -@@ -1587,6 +1776,8 @@ setup(void) +@@ -1581,6 +1770,8 @@ setup(void) scheme = ecalloc(LENGTH(colors), sizeof(Clr *)); for (i = 0; i < LENGTH(colors); i++) scheme[i] = drw_scm_create(drw, colors[i], 3); @@ -511,7 +522,7 @@ index f1d86b2..f9e7e4a 100644 /* init bars */ updatebars(); updatestatus(); -@@ -1717,7 +1908,18 @@ togglebar(const Arg *arg) +@@ -1711,7 +1902,18 @@ togglebar(const Arg *arg) { selmon->showbar = !selmon->showbar; updatebarpos(selmon); @@ -531,7 +542,7 @@ index f1d86b2..f9e7e4a 100644 arrange(selmon); } -@@ -1813,11 +2015,18 @@ unmapnotify(XEvent *e) +@@ -1807,11 +2009,18 @@ unmapnotify(XEvent *e) else unmanage(c, 0); } @@ -550,7 +561,7 @@ index f1d86b2..f9e7e4a 100644 Monitor *m; XSetWindowAttributes wa = { .override_redirect = True, -@@ -1828,10 +2037,15 @@ updatebars(void) +@@ -1822,10 +2031,15 @@ updatebars(void) for (m = mons; m; m = m->next) { if (m->barwin) continue; @@ -567,7 +578,7 @@ index f1d86b2..f9e7e4a 100644 XMapRaised(dpy, m->barwin); XSetClassHint(dpy, m->barwin, &ch); } -@@ -2008,6 +2222,125 @@ updatestatus(void) +@@ -2002,6 +2216,125 @@ updatestatus(void) if (!gettextprop(root, XA_WM_NAME, stext, sizeof(stext))) strcpy(stext, "dwm-"VERSION); drawbar(selmon); @@ -693,7 +704,7 @@ index f1d86b2..f9e7e4a 100644 } void -@@ -2075,6 +2408,16 @@ wintoclient(Window w) +@@ -2069,6 +2402,16 @@ wintoclient(Window w) return NULL; } @@ -710,7 +721,7 @@ index f1d86b2..f9e7e4a 100644 Monitor * wintomon(Window w) { -@@ -2128,6 +2471,22 @@ xerrorstart(Display *dpy, XErrorEvent *ee) +@@ -2122,6 +2465,22 @@ xerrorstart(Display *dpy, XErrorEvent *ee) return -1; }