about summary refs log tree commit diff
path: root/dwm.c
diff options
context:
space:
mode:
authorManuel Palenzuela <manuelpalenzuelamerino@gmail.com>2019-06-10 17:21:18 +0200
committerManuel Palenzuela <manuelpalenzuelamerino@gmail.com>2019-06-10 17:21:18 +0200
commitd8f90b52af18c41f8a6248a3334e346a49d1b03f (patch)
tree32cfd726b43985641ead93855be4b91044cd1fc1 /dwm.c
parentRemoved unnecesary patch (diff)
downloaddwm-d8f90b52af18c41f8a6248a3334e346a49d1b03f.tar.gz
dwm-d8f90b52af18c41f8a6248a3334e346a49d1b03f.tar.bz2
dwm-d8f90b52af18c41f8a6248a3334e346a49d1b03f.zip
Added cyclelayouts and removed some keybindings [Patch]
Diffstat (limited to 'dwm.c')
-rw-r--r--dwm.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/dwm.c b/dwm.c
index e60127e..c241786 100644
--- a/dwm.c
+++ b/dwm.c
@@ -160,6 +160,7 @@ static void configure(Client *c);
 static void configurenotify(XEvent *e);
 static void configurerequest(XEvent *e);
 static Monitor *createmon(void);
+static void cyclelayout(const Arg *arg);
 static void destroynotify(XEvent *e);
 static void detach(Client *c);
 static void detachstack(Client *c);
@@ -656,6 +657,23 @@ createmon(void)
 }
 
 void
+cyclelayout(const Arg *arg) {
+  Layout *l;
+	for(l = (Layout *)layouts; l != selmon->lt[selmon->sellt]; l++);
+	if(arg->i > 0) {
+		if(l->symbol && (l + 1)->symbol)
+		  setlayout(&((Arg) { .v = (l + 1) }));
+		else
+			setlayout(&((Arg) { .v = layouts }));
+	} else {
+		if(l != layouts && (l - 1)->symbol)
+			setlayout(&((Arg) { .v = (l - 1) }));
+		else
+			setlayout(&((Arg) { .v = &layouts[LENGTH(layouts) - 2] }));
+	}
+}
+
+void
 destroynotify(XEvent *e)
 {
 	Client *c;