From ffb757a532d79ac209ade8e6c38952514edeac7b Mon Sep 17 00:00:00 2001 From: Acid Bong Date: Fri, 21 Oct 2022 17:11:51 +0300 Subject: unpatch: cursorwarp (my window borders are thick enough) --- patches/6-cursorwarp-6.3.diff | 52 ----------- patches/6-focusurgent-20160831-56a31dc.diff | 55 ++++++++++++ patches/7-focusonclick-20200110-61bb8b2.diff | 130 +++++++++++++++++++++++++++ patches/7-focusurgent-20160831-56a31dc.diff | 55 ------------ patches/8-focusonclick-20200110-61bb8b2.diff | 130 --------------------------- 5 files changed, 185 insertions(+), 237 deletions(-) delete mode 100644 patches/6-cursorwarp-6.3.diff create mode 100644 patches/6-focusurgent-20160831-56a31dc.diff create mode 100644 patches/7-focusonclick-20200110-61bb8b2.diff delete mode 100644 patches/7-focusurgent-20160831-56a31dc.diff delete mode 100644 patches/8-focusonclick-20200110-61bb8b2.diff (limited to 'patches') diff --git a/patches/6-cursorwarp-6.3.diff b/patches/6-cursorwarp-6.3.diff deleted file mode 100644 index 39be99d..0000000 --- a/patches/6-cursorwarp-6.3.diff +++ /dev/null @@ -1,52 +0,0 @@ -From 94362c75d92a77d11dfbfecce89394b2e0078cd0 Mon Sep 17 00:00:00 2001 -From: Finn Rayment -Date: Sun, 21 Aug 2022 13:56:50 +1000 -Subject: [PATCH] Added cursor warp for refocus and window spawn/death - ---- - dwm.c | 8 ++++++++ - 1 file changed, 8 insertions(+) - -diff --git a/dwm.c b/dwm.c -index a96f33c..f0e8a39 100644 ---- a/dwm.c -+++ b/dwm.c -@@ -831,6 +831,8 @@ focusmon(const Arg *arg) - unfocus(selmon->sel, 0); - selmon = m; - focus(NULL); -+ if (selmon->sel) -+ XWarpPointer(dpy, None, selmon->sel->win, 0, 0, 0, 0, selmon->sel->w/2, selmon->sel->h/2); - } - - void -@@ -856,6 +858,7 @@ focusstack(const Arg *arg) - if (c) { - focus(c); - restack(selmon); -+ XWarpPointer(dpy, None, c->win, 0, 0, 0, 0, c->w/2, c->h/2); - } - } - -@@ -1077,6 +1080,8 @@ manage(Window w, XWindowAttributes *wa) - c->mon->sel = c; - arrange(c->mon); - XMapWindow(dpy, c->win); -+ if (c && c->mon == selmon) -+ XWarpPointer(dpy, None, c->win, 0, 0, 0, 0, c->w/2, c->h/2); - focus(NULL); - } - -@@ -1788,6 +1793,9 @@ unmanage(Client *c, int destroyed) - focus(NULL); - updateclientlist(); - arrange(m); -+ if (m == selmon && m->sel) -+ XWarpPointer(dpy, None, m->sel->win, 0, 0, 0, 0, -+ m->sel->w/2, m->sel->h/2); - } - - void --- -2.35.1 - diff --git a/patches/6-focusurgent-20160831-56a31dc.diff b/patches/6-focusurgent-20160831-56a31dc.diff new file mode 100644 index 0000000..23a0858 --- /dev/null +++ b/patches/6-focusurgent-20160831-56a31dc.diff @@ -0,0 +1,55 @@ +From e9c46c8624e3de1fba021c30bbc42707ef51353c Mon Sep 17 00:00:00 2001 +From: Acid Bong +Date: Wed, 19 Oct 2022 13:23:34 +0300 +Subject: [PATCH] patch: focusurgent + +--- + config.def.h | 3 +++ + focusurgent.c | 14 ++++++++++++++ + 2 files changed, 17 insertions(+) + create mode 100644 focusurgent.c + +diff --git a/config.def.h b/config.def.h +index b8f0908..1de3c06 100644 +--- a/config.def.h ++++ b/config.def.h +@@ -59,6 +59,7 @@ static const char *termcmd[] = { "st", NULL }; + + #include + #include "movestack.c" ++#include "focusurgent.c" + static const Key keys[] = { + /* modifier key function argument */ + { MODKEY, XK_space, spawn, {.v = dmenucmd } }, +@@ -124,6 +125,8 @@ static const Key keys[] = { + { MODKEY|ShiftMask, XK_k, movestack, {.i = -1 } }, + { MODKEY|ShiftMask, XK_Down, movestack, {.i = +1 } }, /* arrow keys */ + { MODKEY|ShiftMask, XK_Up, movestack, {.i = -1 } }, ++ /* focusurgent patch */ ++ { MODKEY, XK_a, focusurgent, {0} }, + }; + + /* button definitions */ +diff --git a/focusurgent.c b/focusurgent.c +new file mode 100644 +index 0000000..bc6eee6 +--- /dev/null ++++ b/focusurgent.c +@@ -0,0 +1,14 @@ ++static void ++focusurgent(const Arg *arg) { ++ Client *c; ++ int i; ++ for(c=selmon->clients; c && !c->isurgent; c=c->next); ++ if(c) { ++ for(i=0; i < LENGTH(tags) && !((1 << i) & c->tags); i++); ++ if(i < LENGTH(tags)) { ++ const Arg a = {.ui = 1 << i}; ++ view(&a); ++ focus(c); ++ } ++ } ++} +-- +2.38.0 + diff --git a/patches/7-focusonclick-20200110-61bb8b2.diff b/patches/7-focusonclick-20200110-61bb8b2.diff new file mode 100644 index 0000000..b6ba2bb --- /dev/null +++ b/patches/7-focusonclick-20200110-61bb8b2.diff @@ -0,0 +1,130 @@ +From f44fcd4f15932c08ca0d2e1b995a4707c476a564 Mon Sep 17 00:00:00 2001 +From: Acid Bong +Date: Wed, 19 Oct 2022 13:28:19 +0300 +Subject: [PATCH] patch: focusonclick (my fav) + +--- + config.def.h | 1 + + dwm.c | 47 ++++------------------------------------------- + 2 files changed, 5 insertions(+), 43 deletions(-) + +diff --git a/config.def.h b/config.def.h +index 1de3c06..eddbc03 100644 +--- a/config.def.h ++++ b/config.def.h +@@ -9,6 +9,7 @@ static const unsigned int systrayonleft = 0; /* 0: systray in the right corne + static const unsigned int systrayspacing = 2; /* systray spacing */ + static const int systraypinningfailfirst = 1; /* 1: if pinning fails, display systray on the first monitor, False: display systray on the last monitor*/ + static const int showsystray = 1; /* 0 means no systray */ ++static const int focusonwheel = 0; + 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" }; +diff --git a/dwm.c b/dwm.c +index 40ac0df..412f04f 100644 +--- a/dwm.c ++++ b/dwm.c +@@ -186,7 +186,6 @@ static void detachstack(Client *c); + 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); +@@ -206,7 +205,6 @@ static void manage(Window w, XWindowAttributes *wa); + static void mappingnotify(XEvent *e); + static void maprequest(XEvent *e); + static void monocle(Monitor *m); +-static void motionnotify(XEvent *e); + static void movemouse(const Arg *arg); + static Client *nexttiled(Client *c); + static void pop(Client *c); +@@ -284,13 +282,11 @@ static void (*handler[LASTEvent]) (XEvent *) = { + [ConfigureRequest] = configurerequest, + [ConfigureNotify] = configurenotify, + [DestroyNotify] = destroynotify, +- [EnterNotify] = enternotify, + [Expose] = expose, + [FocusIn] = focusin, + [KeyPress] = keypress, + [MappingNotify] = mappingnotify, + [MapRequest] = maprequest, +- [MotionNotify] = motionnotify, + [PropertyNotify] = propertynotify, + [ResizeRequest] = resizerequest, + [UnmapNotify] = unmapnotify +@@ -462,7 +458,8 @@ buttonpress(XEvent *e) + + click = ClkRootWin; + /* focus monitor if necessary */ +- if ((m = wintomon(ev->window)) && m != selmon) { ++ if ((m = wintomon(ev->window)) && m != selmon ++ && (focusonwheel || (ev->button != Button4 && ev->button != Button5))) { + unfocus(selmon->sel, 1); + selmon = m; + focus(NULL); +@@ -482,8 +479,8 @@ buttonpress(XEvent *e) + else + click = ClkWinTitle; + } else if ((c = wintoclient(ev->window))) { +- focus(c); +- restack(selmon); ++ if (focusonwheel || (ev->button != Button4 && ev->button != Button5)) ++ focus(c); + XAllowEvents(dpy, ReplayPointer, CurrentTime); + click = ClkClientWin; + } +@@ -859,25 +856,6 @@ drawbars(void) + drawbar(m); + } + +-void +-enternotify(XEvent *e) +-{ +- Client *c; +- Monitor *m; +- XCrossingEvent *ev = &e->xcrossing; +- +- if ((ev->mode != NotifyNormal || ev->detail == NotifyInferior) && ev->window != root) +- return; +- c = wintoclient(ev->window); +- m = c ? c->mon : wintomon(ev->window); +- if (m != selmon) { +- unfocus(selmon->sel, 1); +- selmon = m; +- } else if (!c || c == selmon->sel) +- return; +- focus(c); +-} +- + void + expose(XEvent *e) + { +@@ -1257,23 +1235,6 @@ monocle(Monitor *m) + resize(c, m->wx, m->wy, m->ww - 2 * c->bw, m->wh - 2 * c->bw, 0); + } + +-void +-motionnotify(XEvent *e) +-{ +- static Monitor *mon = NULL; +- Monitor *m; +- XMotionEvent *ev = &e->xmotion; +- +- if (ev->window != root) +- return; +- if ((m = recttomon(ev->x_root, ev->y_root, 1, 1)) != mon && mon) { +- unfocus(selmon->sel, 1); +- selmon = m; +- focus(NULL); +- } +- mon = m; +-} +- + void + movemouse(const Arg *arg) + { +-- +2.38.0 + diff --git a/patches/7-focusurgent-20160831-56a31dc.diff b/patches/7-focusurgent-20160831-56a31dc.diff deleted file mode 100644 index 23a0858..0000000 --- a/patches/7-focusurgent-20160831-56a31dc.diff +++ /dev/null @@ -1,55 +0,0 @@ -From e9c46c8624e3de1fba021c30bbc42707ef51353c Mon Sep 17 00:00:00 2001 -From: Acid Bong -Date: Wed, 19 Oct 2022 13:23:34 +0300 -Subject: [PATCH] patch: focusurgent - ---- - config.def.h | 3 +++ - focusurgent.c | 14 ++++++++++++++ - 2 files changed, 17 insertions(+) - create mode 100644 focusurgent.c - -diff --git a/config.def.h b/config.def.h -index b8f0908..1de3c06 100644 ---- a/config.def.h -+++ b/config.def.h -@@ -59,6 +59,7 @@ static const char *termcmd[] = { "st", NULL }; - - #include - #include "movestack.c" -+#include "focusurgent.c" - static const Key keys[] = { - /* modifier key function argument */ - { MODKEY, XK_space, spawn, {.v = dmenucmd } }, -@@ -124,6 +125,8 @@ static const Key keys[] = { - { MODKEY|ShiftMask, XK_k, movestack, {.i = -1 } }, - { MODKEY|ShiftMask, XK_Down, movestack, {.i = +1 } }, /* arrow keys */ - { MODKEY|ShiftMask, XK_Up, movestack, {.i = -1 } }, -+ /* focusurgent patch */ -+ { MODKEY, XK_a, focusurgent, {0} }, - }; - - /* button definitions */ -diff --git a/focusurgent.c b/focusurgent.c -new file mode 100644 -index 0000000..bc6eee6 ---- /dev/null -+++ b/focusurgent.c -@@ -0,0 +1,14 @@ -+static void -+focusurgent(const Arg *arg) { -+ Client *c; -+ int i; -+ for(c=selmon->clients; c && !c->isurgent; c=c->next); -+ if(c) { -+ for(i=0; i < LENGTH(tags) && !((1 << i) & c->tags); i++); -+ if(i < LENGTH(tags)) { -+ const Arg a = {.ui = 1 << i}; -+ view(&a); -+ focus(c); -+ } -+ } -+} --- -2.38.0 - diff --git a/patches/8-focusonclick-20200110-61bb8b2.diff b/patches/8-focusonclick-20200110-61bb8b2.diff deleted file mode 100644 index b6ba2bb..0000000 --- a/patches/8-focusonclick-20200110-61bb8b2.diff +++ /dev/null @@ -1,130 +0,0 @@ -From f44fcd4f15932c08ca0d2e1b995a4707c476a564 Mon Sep 17 00:00:00 2001 -From: Acid Bong -Date: Wed, 19 Oct 2022 13:28:19 +0300 -Subject: [PATCH] patch: focusonclick (my fav) - ---- - config.def.h | 1 + - dwm.c | 47 ++++------------------------------------------- - 2 files changed, 5 insertions(+), 43 deletions(-) - -diff --git a/config.def.h b/config.def.h -index 1de3c06..eddbc03 100644 ---- a/config.def.h -+++ b/config.def.h -@@ -9,6 +9,7 @@ static const unsigned int systrayonleft = 0; /* 0: systray in the right corne - static const unsigned int systrayspacing = 2; /* systray spacing */ - static const int systraypinningfailfirst = 1; /* 1: if pinning fails, display systray on the first monitor, False: display systray on the last monitor*/ - static const int showsystray = 1; /* 0 means no systray */ -+static const int focusonwheel = 0; - 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" }; -diff --git a/dwm.c b/dwm.c -index 40ac0df..412f04f 100644 ---- a/dwm.c -+++ b/dwm.c -@@ -186,7 +186,6 @@ static void detachstack(Client *c); - 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); -@@ -206,7 +205,6 @@ static void manage(Window w, XWindowAttributes *wa); - static void mappingnotify(XEvent *e); - static void maprequest(XEvent *e); - static void monocle(Monitor *m); --static void motionnotify(XEvent *e); - static void movemouse(const Arg *arg); - static Client *nexttiled(Client *c); - static void pop(Client *c); -@@ -284,13 +282,11 @@ static void (*handler[LASTEvent]) (XEvent *) = { - [ConfigureRequest] = configurerequest, - [ConfigureNotify] = configurenotify, - [DestroyNotify] = destroynotify, -- [EnterNotify] = enternotify, - [Expose] = expose, - [FocusIn] = focusin, - [KeyPress] = keypress, - [MappingNotify] = mappingnotify, - [MapRequest] = maprequest, -- [MotionNotify] = motionnotify, - [PropertyNotify] = propertynotify, - [ResizeRequest] = resizerequest, - [UnmapNotify] = unmapnotify -@@ -462,7 +458,8 @@ buttonpress(XEvent *e) - - click = ClkRootWin; - /* focus monitor if necessary */ -- if ((m = wintomon(ev->window)) && m != selmon) { -+ if ((m = wintomon(ev->window)) && m != selmon -+ && (focusonwheel || (ev->button != Button4 && ev->button != Button5))) { - unfocus(selmon->sel, 1); - selmon = m; - focus(NULL); -@@ -482,8 +479,8 @@ buttonpress(XEvent *e) - else - click = ClkWinTitle; - } else if ((c = wintoclient(ev->window))) { -- focus(c); -- restack(selmon); -+ if (focusonwheel || (ev->button != Button4 && ev->button != Button5)) -+ focus(c); - XAllowEvents(dpy, ReplayPointer, CurrentTime); - click = ClkClientWin; - } -@@ -859,25 +856,6 @@ drawbars(void) - drawbar(m); - } - --void --enternotify(XEvent *e) --{ -- Client *c; -- Monitor *m; -- XCrossingEvent *ev = &e->xcrossing; -- -- if ((ev->mode != NotifyNormal || ev->detail == NotifyInferior) && ev->window != root) -- return; -- c = wintoclient(ev->window); -- m = c ? c->mon : wintomon(ev->window); -- if (m != selmon) { -- unfocus(selmon->sel, 1); -- selmon = m; -- } else if (!c || c == selmon->sel) -- return; -- focus(c); --} -- - void - expose(XEvent *e) - { -@@ -1257,23 +1235,6 @@ monocle(Monitor *m) - resize(c, m->wx, m->wy, m->ww - 2 * c->bw, m->wh - 2 * c->bw, 0); - } - --void --motionnotify(XEvent *e) --{ -- static Monitor *mon = NULL; -- Monitor *m; -- XMotionEvent *ev = &e->xmotion; -- -- if (ev->window != root) -- return; -- if ((m = recttomon(ev->x_root, ev->y_root, 1, 1)) != mon && mon) { -- unfocus(selmon->sel, 1); -- selmon = m; -- focus(NULL); -- } -- mon = m; --} -- - void - movemouse(const Arg *arg) - { --- -2.38.0 - -- cgit 1.4.1-2-gfad0