about summary refs log tree commit diff stats
path: root/screen.c
diff options
context:
space:
mode:
authorAnselm R. Garbe <arg@suckless.org>2007-02-19 18:33:15 +0100
committerAnselm R. Garbe <arg@suckless.org>2007-02-19 18:33:15 +0100
commit879241c05cbf959304a2dc4f2fabcdcecaea5092 (patch)
tree824a9185087d91eff6021c646c2372033e4f9f56 /screen.c
parent3794c6294535518fdcdf2ceb434875584189aa1e (diff)
downloaddwm-879241c05cbf959304a2dc4f2fabcdcecaea5092.tar.gz
replaced togglelayout with setlayout
Diffstat (limited to 'screen.c')
-rw-r--r--screen.c37
1 files changed, 22 insertions, 15 deletions
diff --git a/screen.c b/screen.c
index 5907ba7..8abe3d7 100644
--- a/screen.c
+++ b/screen.c
@@ -191,6 +191,28 @@ restack(void) {
 }
 
 void
+setlayout(Arg *arg) {
+	unsigned int i;
+
+	if(arg->i == -1) {
+		for(i = 0; i < nlayouts && lt != &layout[i]; i++);
+		if(i == nlayouts - 1)
+			lt = &layout[0];
+		else
+			lt = &layout[++i];
+	}
+	else {
+		if(arg->i < 0 || arg->i >= nlayouts)
+			return;
+		lt = &layout[arg->i];
+	}
+	if(sel)
+		lt->arrange();
+	else
+		drawstatus();
+}
+
+void
 settags(Client *c, Client *trans) {
 	char prop[512];
 	unsigned int i, j;
@@ -253,21 +275,6 @@ toggletag(Arg *arg) {
 }
 
 void
-togglelayout(Arg *arg) {
-	unsigned int i;
-
-	for(i = 0; i < nlayouts && lt != &layout[i]; i++);
-	if(i == nlayouts - 1)
-		lt = &layout[0];
-	else
-		lt = &layout[++i];
-	if(sel)
-		lt->arrange();
-	else
-		drawstatus();
-}
-
-void
 toggleversatile(Arg *arg) {
 	if(!sel || lt->arrange == versatile)
 		return;