summaryrefslogtreecommitdiffhomepage
path: root/patch
diff options
context:
space:
mode:
authorbakkeby <[email protected]>2019-10-10 23:33:04 +0200
committerbakkeby <[email protected]>2019-10-10 23:33:04 +0200
commit2eb8bcdf153d608caf1e23817b463fd03cc44b72 (patch)
tree3beb8b5ea556c2788b58fe4a15882686a8e40f9a /patch
parented1c509df3faf757a5b46bae0cfa59035977b50c (diff)
downloaddwm-flexipatch-2eb8bcdf153d608caf1e23817b463fd03cc44b72.tar.gz
dwm-flexipatch-2eb8bcdf153d608caf1e23817b463fd03cc44b72.zip
Adding scratchpad patch
Diffstat (limited to 'patch')
-rw-r--r--patch/include.c4
-rw-r--r--patch/include.h4
-rw-r--r--patch/scratchpad.c23
-rw-r--r--patch/scratchpad.h1
4 files changed, 32 insertions, 0 deletions
diff --git a/patch/include.c b/patch/include.c
index e86b053..7d99f76 100644
--- a/patch/include.c
+++ b/patch/include.c
@@ -94,6 +94,10 @@
#include "rotatestack.c"
#endif
+#if SCRATCHPAD_PATCH
+#include "scratchpad.c"
+#endif
+
#if SELFRESTART_PATCH
#include "selfrestart.c"
#endif
diff --git a/patch/include.h b/patch/include.h
index c38f849..c2586b4 100644
--- a/patch/include.h
+++ b/patch/include.h
@@ -94,6 +94,10 @@
#include "rotatestack.h"
#endif
+#if SCRATCHPAD_PATCH
+#include "scratchpad.h"
+#endif
+
#if SELFRESTART_PATCH
#include "selfrestart.h"
#endif
diff --git a/patch/scratchpad.c b/patch/scratchpad.c
new file mode 100644
index 0000000..7ba6366
--- /dev/null
+++ b/patch/scratchpad.c
@@ -0,0 +1,23 @@
+static unsigned int scratchtag = 1 << LENGTH(tags);
+
+void
+togglescratch(const Arg *arg)
+{
+ Client *c;
+ unsigned int found = 0;
+
+ for (c = selmon->clients; c && !(found = c->tags & scratchtag); c = c->next);
+ if (found) {
+ unsigned int newtagset = selmon->tagset[selmon->seltags] ^ scratchtag;
+ if (newtagset) {
+ selmon->tagset[selmon->seltags] = newtagset;
+ focus(NULL);
+ arrange(selmon);
+ }
+ if (ISVISIBLE(c)) {
+ focus(c);
+ restack(selmon);
+ }
+ } else
+ spawn(arg);
+} \ No newline at end of file
diff --git a/patch/scratchpad.h b/patch/scratchpad.h
new file mode 100644
index 0000000..be5c3a4
--- /dev/null
+++ b/patch/scratchpad.h
@@ -0,0 +1 @@
+static void togglescratch(const Arg *arg); \ No newline at end of file