aboutsummaryrefslogtreecommitdiff
path: root/dwl.c
diff options
context:
space:
mode:
authorDevin J. Pohly <djpohly@gmail.com>2020-04-23 20:02:17 -0500
committerDevin J. Pohly <djpohly@gmail.com>2020-04-23 22:11:52 -0500
commit66054700cb58d97f3f333317db18b24e0f39ef2c (patch)
tree47e98f39b016dd11f45e730b26704fbc3d1cef49 /dwl.c
parent35557ab0426ba326e7bba8f1aeac1ac5495bf079 (diff)
add toggletag and toggleview
Diffstat (limited to 'dwl.c')
-rw-r--r--dwl.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/dwl.c b/dwl.c
index df72eef..c58a7e0 100644
--- a/dwl.c
+++ b/dwl.c
@@ -154,6 +154,8 @@ static void spawn(const Arg *arg);
static void tag(const Arg *arg);
static void tile(Monitor *m);
static void togglefloating(const Arg *arg);
+static void toggletag(const Arg *arg);
+static void toggleview(const Arg *arg);
static void unmapnotify(struct wl_listener *listener, void *data);
static void view(const Arg *arg);
static Client *xytoclient(double x, double y,
@@ -1117,6 +1119,31 @@ togglefloating(const Arg *arg)
}
void
+toggletag(const Arg *arg)
+{
+ unsigned int newtags;
+ Client *sel = selclient();
+ if (!sel)
+ return;
+ newtags = sel->tags ^ (arg->ui & TAGMASK);
+ if (newtags) {
+ sel->tags = newtags;
+ focus(NULL, NULL);
+ }
+}
+
+void
+toggleview(const Arg *arg)
+{
+ unsigned int newtagset = selmon->tagset[selmon->seltags] ^ (arg->ui & TAGMASK);
+
+ if (newtagset) {
+ selmon->tagset[selmon->seltags] = newtagset;
+ focus(NULL, NULL);
+ }
+}
+
+void
unmapnotify(struct wl_listener *listener, void *data)
{
/* Called when the surface is unmapped, and should no longer be shown. */