aboutsummaryrefslogtreecommitdiff
path: root/sys/cmd/dwm/hook.c
diff options
context:
space:
mode:
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;