diff options
author | Manuel Palenzuela <manuelpalenzuelamerino@gmail.com> | 2019-06-09 17:55:09 +0200 |
---|---|---|
committer | Manuel Palenzuela <manuelpalenzuelamerino@gmail.com> | 2019-06-09 17:55:09 +0200 |
commit | 69940cfd62576eb6079277847ceba00b322ffadf (patch) | |
tree | 02c024f60634eabd39aabf07b1a9993012110b2a /patches | |
parent | Removed ignored files (diff) | |
download | dwm-69940cfd62576eb6079277847ceba00b322ffadf.tar.gz dwm-69940cfd62576eb6079277847ceba00b322ffadf.tar.bz2 dwm-69940cfd62576eb6079277847ceba00b322ffadf.zip |
Fixed gitignore
Diffstat (limited to 'patches')
-rw-r--r-- | patches/dwm-ewmhtags-20180101-db22360.diff | 154 | ||||
-rw-r--r-- | patches/dwm-focusonclick-20171030-6aa8e37.diff | 130 |
2 files changed, 284 insertions, 0 deletions
diff --git a/patches/dwm-ewmhtags-20180101-db22360.diff b/patches/dwm-ewmhtags-20180101-db22360.diff new file mode 100644 index 0000000..8196bc2 --- /dev/null +++ b/patches/dwm-ewmhtags-20180101-db22360.diff @@ -0,0 +1,154 @@ +From 44ad1a9255504ef36670f46101689b2ab9d8501e Mon Sep 17 00:00:00 2001 +From: rangerlatham <ghanklatham@gmail.com> +Date: Sun, 31 Dec 2017 19:26:47 -0500 +Subject: [PATCH] patch that adds ewmh functionality to dwm. see + dwm.suckless.org/patches/ewmhtags for more details + +--- + dwm.c | 48 +++++++++++++++++++++++++++++++++++++++++++++++- + 1 file changed, 47 insertions(+), 1 deletion(-) + +diff --git a/dwm.c b/dwm.c +index ec6a27c..018b7aa 100644 +--- a/dwm.c ++++ b/dwm.c +@@ -55,6 +55,7 @@ + #define WIDTH(X) ((X)->w + 2 * (X)->bw) + #define HEIGHT(X) ((X)->h + 2 * (X)->bw) + #define TAGMASK ((1 << LENGTH(tags)) - 1) ++#define TAGSLENGTH (LENGTH(tags)) + #define TEXTW(X) (drw_fontset_getwidth(drw, (X)) + lrpad) + #define ColBorder 2 + +@@ -63,7 +64,7 @@ enum { CurNormal, CurResize, CurMove, CurLast }; /* cursor */ + enum { SchemeNorm, SchemeSel }; /* color schemes */ + enum { NetSupported, NetWMName, NetWMState, NetWMCheck, + NetWMFullscreen, NetActiveWindow, NetWMWindowType, +- NetWMWindowTypeDialog, NetClientList, NetLast }; /* EWMH atoms */ ++ NetWMWindowTypeDialog, NetClientList, NetDesktopNames, NetDesktopViewport, NetNumberOfDesktops, NetCurrentDesktop, NetLast }; /* EWMH atoms */ + enum { WMProtocols, WMDelete, WMState, WMTakeFocus, WMLast }; /* default atoms */ + enum { ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle, + ClkClientWin, ClkRootWin, ClkLast }; /* clicks */ +@@ -198,11 +199,15 @@ static void scan(void); + static int sendevent(Client *c, Atom proto); + static void sendmon(Client *c, Monitor *m); + static void setclientstate(Client *c, long state); ++static void setcurrentdesktop(void); ++static void setdesktopnames(void); + static void setfocus(Client *c); + static void setfullscreen(Client *c, int fullscreen); + static void setlayout(const Arg *arg); + static void setmfact(const Arg *arg); ++static void setnumdesktops(void); + static void setup(void); ++static void setviewport(void); + static void seturgent(Client *c, int urg); + static void showhide(Client *c); + static void sigchld(int unused); +@@ -217,6 +222,7 @@ static void toggleview(const Arg *arg); + static void unfocus(Client *c, int setfocus); + static void unmanage(Client *c, int destroyed); + static void unmapnotify(XEvent *e); ++static void updatecurrentdesktop(void); + static int updategeom(void); + static void updatebarpos(Monitor *m); + static void updatebars(void); +@@ -1432,6 +1438,16 @@ setclientstate(Client *c, long state) + XChangeProperty(dpy, c->win, wmatom[WMState], wmatom[WMState], 32, + PropModeReplace, (unsigned char *)data, 2); + } ++void ++setcurrentdesktop(void){ ++ long data[] = { 0 }; ++ XChangeProperty(dpy, root, netatom[NetCurrentDesktop], XA_CARDINAL, 32, PropModeReplace, (unsigned char *)data, 1); ++} ++void setdesktopnames(void){ ++ XTextProperty text; ++ Xutf8TextListToTextProperty(dpy, tags, TAGSLENGTH, XUTF8StringStyle, &text); ++ XSetTextProperty(dpy, root, &text, netatom[NetDesktopNames]); ++} + + int + sendevent(Client *c, Atom proto) +@@ -1527,6 +1543,12 @@ setmfact(const Arg *arg) + arrange(selmon); + } + ++void ++setnumdesktops(void){ ++ long data[] = { TAGSLENGTH }; ++ XChangeProperty(dpy, root, netatom[NetNumberOfDesktops], XA_CARDINAL, 32, PropModeReplace, (unsigned char *)data, 1); ++} ++ + void + setup(void) + { +@@ -1563,6 +1585,10 @@ 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); ++ netatom[NetDesktopViewport] = XInternAtom(dpy, "_NET_DESKTOP_VIEWPORT", False); ++ netatom[NetNumberOfDesktops] = XInternAtom(dpy, "_NET_NUMBER_OF_DESKTOPS", False); ++ netatom[NetCurrentDesktop] = XInternAtom(dpy, "_NET_CURRENT_DESKTOP", False); ++ netatom[NetDesktopNames] = XInternAtom(dpy, "_NET_DESKTOP_NAMES", False); + /* init cursors */ + cursor[CurNormal] = drw_cur_create(drw, XC_left_ptr); + cursor[CurResize] = drw_cur_create(drw, XC_sizing); +@@ -1585,6 +1611,10 @@ setup(void) + /* EWMH support per view */ + XChangeProperty(dpy, root, netatom[NetSupported], XA_ATOM, 32, + PropModeReplace, (unsigned char *) netatom, NetLast); ++ setnumdesktops(); ++ setcurrentdesktop(); ++ setdesktopnames(); ++ setviewport(); + XDeleteProperty(dpy, root, netatom[NetClientList]); + /* select events */ + wa.cursor = cursor[CurNormal]->cursor; +@@ -1596,6 +1626,11 @@ setup(void) + grabkeys(); + focus(NULL); + } ++void ++setviewport(void){ ++ long data[] = { 0, 0 }; ++ XChangeProperty(dpy, root, netatom[NetDesktopViewport], XA_CARDINAL, 32, PropModeReplace, (unsigned char *)data, 2); ++} + + + void +@@ -1745,6 +1780,7 @@ toggleview(const Arg *arg) + focus(NULL); + arrange(selmon); + } ++ updatecurrentdesktop(); + } + + void +@@ -1847,6 +1883,15 @@ updateclientlist() + XA_WINDOW, 32, PropModeAppend, + (unsigned char *) &(c->win), 1); + } ++void updatecurrentdesktop(void){ ++ long rawdata[] = { selmon->tagset[selmon->seltags] }; ++ int i=0; ++ while(*rawdata >> i+1){ ++ i++; ++ } ++ long data[] = { i }; ++ XChangeProperty(dpy, root, netatom[NetCurrentDesktop], XA_CARDINAL, 32, PropModeReplace, (unsigned char *)data, 1); ++} + + int + updategeom(void) +@@ -2043,6 +2088,7 @@ view(const Arg *arg) + selmon->tagset[selmon->seltags] = arg->ui & TAGMASK; + focus(NULL); + arrange(selmon); ++ updatecurrentdesktop(); + } + + Client * +-- +2.15.1 + diff --git a/patches/dwm-focusonclick-20171030-6aa8e37.diff b/patches/dwm-focusonclick-20171030-6aa8e37.diff new file mode 100644 index 0000000..b9df293 --- /dev/null +++ b/patches/dwm-focusonclick-20171030-6aa8e37.diff @@ -0,0 +1,130 @@ +diff --git a/config.def.h b/config.def.h +index a9ac303..1f8dc9a 100644 +--- a/config.def.h ++++ b/config.def.h +@@ -5,6 +5,7 @@ static const unsigned int borderpx = 1; /* border pixel of windows */ + 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 */ ++static const int focusonwheel = 0; + static const char *fonts[] = { "monospace:size=10" }; + static const char dmenufont[] = "monospace:size=10"; + static const char col_gray1[] = "#222222"; +diff --git a/dwm.c b/dwm.c +index 4782343..4e9296d 100644 +--- a/dwm.c ++++ b/dwm.c +@@ -164,7 +164,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); +@@ -182,7 +181,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 *); +@@ -250,13 +248,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, + [UnmapNotify] = unmapnotify + }; +@@ -425,7 +421,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); +@@ -445,10 +442,10 @@ buttonpress(XEvent *e) + else + click = ClkWinTitle; + } else if ((c = wintoclient(ev->window))) { +- focus(c); +- restack(selmon); +- XAllowEvents(dpy, ReplayPointer, CurrentTime); +- click = ClkClientWin; ++ if (focusonwheel || (ev->button != Button4 && ev->button != Button5)) ++ focus(c); ++ XAllowEvents(dpy, ReplayPointer, CurrentTime); ++ click = ClkClientWin; + } + for (i = 0; i < LENGTH(buttons); i++) + if (click == buttons[i].click && buttons[i].func && buttons[i].button == ev->button +@@ -753,25 +750,6 @@ drawbars(void) + } + + 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) + { + Monitor *m; +@@ -943,7 +921,7 @@ grabbuttons(Client *c, int focused) + XGrabButton(dpy, buttons[i].button, + buttons[i].mask | modifiers[j], + c->win, False, BUTTONMASK, +- GrabModeAsync, GrabModeSync, None, None); ++ GrabModeSync, GrabModeSync, None, None); + } + } + +@@ -1118,23 +1096,6 @@ monocle(Monitor *m) + } + + 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) + { + int x, y, ocx, ocy, nx, ny; |