From a576520dce2a34424af67358e98d79a06e736911 Mon Sep 17 00:00:00 2001 From: Nicholas Noll Date: Sun, 19 Jul 2020 09:28:46 -0700 Subject: chore: update --- sys/cmd/dwm/hook.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'sys/cmd/dwm/hook.c') 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)); @@ -306,6 +310,31 @@ togglefloating(Arg *arg) arrange(selmon); } +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) { -- cgit v1.2.1