diff options
| author | bakkeby <[email protected]> | 2019-09-10 00:18:46 +0200 |
|---|---|---|
| committer | bakkeby <[email protected]> | 2019-09-10 00:30:17 +0200 |
| commit | d6517bf4f83298cd8655481c474519987b41c71c (patch) | |
| tree | 96fea81a537246c79a74f648d233c00b63b8072d /patch | |
| parent | 4a17b880ad2cc4ae9098809ca3ccf4d439127450 (diff) | |
| download | dwm-flexipatch-d6517bf4f83298cd8655481c474519987b41c71c.tar.gz dwm-flexipatch-d6517bf4f83298cd8655481c474519987b41c71c.zip | |
Adding awesomebar patch
Diffstat (limited to 'patch')
| -rw-r--r-- | patch/awesomebar.c | 49 | ||||
| -rw-r--r-- | patch/awesomebar.h | 3 | ||||
| -rw-r--r-- | patch/include.c | 4 | ||||
| -rw-r--r-- | patch/include.h | 4 |
4 files changed, 60 insertions, 0 deletions
diff --git a/patch/awesomebar.c b/patch/awesomebar.c new file mode 100644 index 0000000..20a54c7 --- /dev/null +++ b/patch/awesomebar.c @@ -0,0 +1,49 @@ +void +hide(Client *c) { + if (!c || HIDDEN(c)) + return; + + Window w = c->win; + static XWindowAttributes ra, ca; + + // more or less taken directly from blackbox's hide() function + XGrabServer(dpy); + XGetWindowAttributes(dpy, root, &ra); + XGetWindowAttributes(dpy, w, &ca); + // prevent UnmapNotify events + XSelectInput(dpy, root, ra.your_event_mask & ~SubstructureNotifyMask); + XSelectInput(dpy, w, ca.your_event_mask & ~StructureNotifyMask); + XUnmapWindow(dpy, w); + setclientstate(c, IconicState); + XSelectInput(dpy, root, ra.your_event_mask); + XSelectInput(dpy, w, ca.your_event_mask); + XUngrabServer(dpy); + + focus(c->snext); + arrange(c->mon); +} + +void +show(Client *c) +{ + if (!c || !HIDDEN(c)) + return; + + XMapWindow(dpy, c->win); + setclientstate(c, NormalState); + arrange(c->mon); +} + +void +togglewin(const Arg *arg) +{ + Client *c = (Client*)arg->v; + if (c == selmon->sel) + hide(c); + else { + if (HIDDEN(c)) + show(c); + focus(c); + restack(selmon); + } +}
\ No newline at end of file diff --git a/patch/awesomebar.h b/patch/awesomebar.h new file mode 100644 index 0000000..2ca3dd1 --- /dev/null +++ b/patch/awesomebar.h @@ -0,0 +1,3 @@ +static void hide(Client *c); +static void show(Client *c); +static void togglewin(const Arg *arg);
\ No newline at end of file diff --git a/patch/include.c b/patch/include.c index 04d66f4..43a636b 100644 --- a/patch/include.c +++ b/patch/include.c @@ -16,6 +16,10 @@ #include "autostart.c" #endif +#if AWESOMEBAR_PATCH +#include "awesomebar.c" +#endif + #if CFACTS_PATCH #include "cfacts.c" #endif diff --git a/patch/include.h b/patch/include.h index f76f6f1..49d3a1c 100644 --- a/patch/include.h +++ b/patch/include.h @@ -16,6 +16,10 @@ #include "autostart.h" #endif +#if AWESOMEBAR_PATCH +#include "awesomebar.h" +#endif + #if CFACTS_PATCH #include "cfacts.h" #endif |
