diff options
| author | Thomas Ulmer <thomasmulmer02@gmail.com> | 2025-12-04 11:06:05 -0800 |
|---|---|---|
| committer | Thomas Ulmer <thomasmulmer02@gmail.com> | 2025-12-04 11:06:05 -0800 |
| commit | 4d784b558be27e73f54149e51ac6fd1380c39e4c (patch) | |
| tree | 3a15c4739c95a556e71554bedab4d8a88a537362 /dwm | |
| parent | 2089794e3f29f87f2d0c5d445e2bdac4968a3a99 (diff) | |
dwm: cleanup, win by name
Diffstat (limited to 'dwm')
| -rw-r--r-- | dwm/my-no-focus-follows-mouse.diff | 16 | ||||
| -rw-r--r-- | dwm/my-selwin.diff | 92 | ||||
| -rwxr-xr-x | dwm/setup.sh | 1 |
3 files changed, 105 insertions, 4 deletions
diff --git a/dwm/my-no-focus-follows-mouse.diff b/dwm/my-no-focus-follows-mouse.diff index aefcb3c..969964a 100644 --- a/dwm/my-no-focus-follows-mouse.diff +++ b/dwm/my-no-focus-follows-mouse.diff @@ -1,7 +1,15 @@ -diff -ruN ../dwm-clean/dwm.c ./dwm.c +diff -urN ../dwm-clean/dwm.c ./dwm.c --- ../dwm-clean/dwm.c 2025-08-09 06:00:55.740267680 -0700 -+++ ./dwm.c 2025-12-03 19:36:27.601767290 -0800 -@@ -248,7 +248,6 @@ ++++ ./dwm.c 2025-12-04 11:03:07.527930789 -0800 +@@ -162,7 +162,6 @@ + static Monitor *dirtomon(int dir); + static void drawbar(Monitor *m); + static void drawbars(void); +-static void enternotify(XEvent *e); + static void expose(XEvent *e); + static void focus(Client *c); + static void focusin(XEvent *e); +@@ -248,7 +247,6 @@ [ConfigureRequest] = configurerequest, [ConfigureNotify] = configurenotify, [DestroyNotify] = destroynotify, @@ -9,7 +17,7 @@ diff -ruN ../dwm-clean/dwm.c ./dwm.c [Expose] = expose, [FocusIn] = focusin, [KeyPress] = keypress, -@@ -757,25 +756,6 @@ +@@ -757,25 +755,6 @@ } void diff --git a/dwm/my-selwin.diff b/dwm/my-selwin.diff new file mode 100644 index 0000000..66ab6be --- /dev/null +++ b/dwm/my-selwin.diff @@ -0,0 +1,92 @@ +diff -urN ../dwm-clean/config.def.h ./config.def.h +--- ../dwm-clean/config.def.h 2025-08-09 06:00:55.740267680 -0700 ++++ ./config.def.h 2025-12-04 11:02:06.893182108 -0800 +@@ -73,6 +73,7 @@ + { MODKEY, XK_l, setmfact, {.f = +0.05} }, + { MODKEY, XK_Return, zoom, {0} }, + { MODKEY, XK_Tab, view, {0} }, ++ { MODKEY, XK_w, selectclient, {0} }, + { MODKEY|ShiftMask, XK_c, killclient, {0} }, + { MODKEY, XK_t, setlayout, {.v = &layouts[0]} }, + { MODKEY, XK_f, setlayout, {.v = &layouts[1]} }, +diff -urN ../dwm-clean/dwm.c ./dwm.c +--- ../dwm-clean/dwm.c 2025-08-09 06:00:55.740267680 -0700 ++++ ./dwm.c 2025-12-04 11:01:00.243873971 -0800 +@@ -194,6 +194,7 @@ + static void restack(Monitor *m); + static void run(void); + static void scan(void); ++static void selectclient(const Arg *arg); + static int sendevent(Client *c, Atom proto); + static void sendmon(Client *c, Monitor *m); + static void setclientstate(Client *c, long state); +@@ -1416,6 +1417,69 @@ + } + } + ++void ++selectclient(const Arg *_arg) ++{ ++ static const char* dmenuwincmd[] = { "dmenu", "-i", "-m", dmenumon, "-fn", dmenufont, "-nb", col_gray1, "-nf", col_gray3, "-sb", col_purple, "-sf", col_gray4, NULL }; ++ Client *c; ++ int fds[4]; /* cin,sout,sin,cout */ ++ const char ln = '\n'; ++ char selected[257]; ++ int ret; ++ struct sigaction sa; ++ Arg arg; ++ ++ dmenumon[0] = '0' + selmon->num; ++ ++ if (pipe(fds)) ++ return; ++ if (pipe(fds+2)) { ++ close(fds[0]); ++ close(fds[1]); ++ return; ++ } ++ if (fork() == 0) { ++ close(fds[1]); ++ close(fds[2]); ++ dup2(fds[0], 0); ++ dup2(fds[3], 1); ++ ++ if (dpy) ++ close(ConnectionNumber(dpy)); ++ setsid(); ++ ++ sigemptyset(&sa.sa_mask); ++ sa.sa_flags = 0; ++ sa.sa_handler = SIG_DFL; ++ sigaction(SIGCHLD, &sa, NULL); ++ ++ execvp(((char **)dmenuwincmd)[0], (char **)dmenuwincmd); ++ die("dwm: execvp 'dmenu' for window select failed:"); ++ } ++ close(fds[0]); ++ close(fds[3]); ++ ++ for (c = selmon->clients; c; c = c->next) { ++ write(fds[1], c->name, strlen(c->name)); ++ write(fds[1], &ln, 1); ++ } ++ close(fds[1]); ++ ret = read(fds[2], selected, 256); ++ for (int i = 0; i < 256 && (selected[i] != '\n' || (selected[i] = 0)); ++i); ++ close(fds[2]); ++ if (ret <= 0) ++ return; ++ for (c = selmon->clients; c; c = c->next) { ++ if (!strcmp(c->name, selected)) { ++ arg.ui = c->tags; ++ view(&arg); ++ focus(c); ++ return; ++ } ++ ++ } ++} ++ + void + sendmon(Client *c, Monitor *m) + { diff --git a/dwm/setup.sh b/dwm/setup.sh index 80d1c20..53c51cb 100755 --- a/dwm/setup.sh +++ b/dwm/setup.sh @@ -6,6 +6,7 @@ set -x tar -xzf dwm-6.6.tar.gz cd dwm-6.6 patch <../my.diff +patch <../my-selwin.diff patch <../my-no-focus-follows-mouse.diff patch <../dwm-movestack-6.6.diff patch <../dwm-quitprompt-20220718-6613d9f.diff |
