aboutsummaryrefslogtreecommitdiff
path: root/sys/cmd/dwm/hook.c
diff options
context:
space:
mode:
authorNicholas Noll <nnoll523@gmail.com>2020-07-19 09:28:46 -0700
committerNicholas Noll <nnoll523@gmail.com>2020-07-19 09:28:46 -0700
commita576520dce2a34424af67358e98d79a06e736911 (patch)
tree38ede99a3cc90544c9d119e2b49cc865b240391a /sys/cmd/dwm/hook.c
parentd4166afda314d3f3326e9f73659a0b4515f2ae65 (diff)
chore: update
Diffstat (limited to 'sys/cmd/dwm/hook.c')
-rw-r--r--sys/cmd/dwm/hook.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/sys/cmd/dwm/hook.c b/sys/cmd/dwm/hook.c
index 1ad45df..cc96ead 100644
--- a/sys/cmd/dwm/hook.c
+++ b/sys/cmd/dwm/hook.c
@@ -1,5 +1,7 @@
#include "dwm.h"
+int scratchtag = 1 << arrlen(tags);
+
void
focusmon(Arg *arg)
{
@@ -254,6 +256,8 @@ setmfact(Arg *arg)
void
spawn(Arg *arg)
{
+ selmon->tagset[selmon->seltags] &= ~scratchtag;
+
if (fork() == 0) {
if (dpy)
close(ConnectionNumber(dpy));
@@ -307,6 +311,31 @@ togglefloating(Arg *arg)
}
void
+togglescratch(Arg *arg)
+{
+ Client *c;
+ uint f = 0;
+
+ for(c = selmon->clients; c && !(f = (c->tags & scratchtag)); c = c->next)
+ ;
+
+ if(f) {
+ f = selmon->tagset[selmon->seltags] ^ scratchtag;
+ if(f) {
+ selmon->tagset[selmon->seltags] = f;
+ focus(nil);
+ arrange(selmon);
+ }
+ if(ISVISIBLE(c)) {
+ focus(c);
+ restack(selmon);
+ }
+ } else
+ spawn(arg);
+
+}
+
+void
toggletag(Arg *arg)
{
uint newtags;