From d76902653a3826490df481ebeae732bcd6bb5f38 Mon Sep 17 00:00:00 2001 From: Julien Danjou Date: Tue, 2 Oct 2007 14:28:39 +0200 Subject: [PATCH] change behaviour of uicb_setlayout: no arg now reset to first/default layout ; add bindings in default config --- awesomerc | 3 ++- layout.c | 14 +++++++------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/awesomerc b/awesomerc index c8b73ed9..ecc07de8 100644 --- a/awesomerc +++ b/awesomerc @@ -66,7 +66,8 @@ awesome: # Keys binding keys = ((("Mod4"), "Return", "spawn", "exec xterm"), - (("Mod4"), "space", "setlayout"), + (("Mod4"), "space", "setlayout", "+1"), + (("Mod4", "Shift"), "space", "setlayout", "-1"), (("Mod4"), "b", "togglebar"), (("Mod4"), "j", "focusnext"), (("Mod4"), "k", "focusprev"), diff --git a/layout.c b/layout.c index 9d1b41ac..96abdf66 100644 --- a/layout.c +++ b/layout.c @@ -166,14 +166,14 @@ uicb_setlayout(Display *disp, int i; Client *c; - for(i = 0; i < awesomeconf->nlayouts && &awesomeconf->layouts[i] != awesomeconf->current_layout; i++); - - if(!arg) - i++; - else + if(arg) + { + for(i = 0; i < awesomeconf->nlayouts && &awesomeconf->layouts[i] != awesomeconf->current_layout; i++); i = compute_new_value_from_arg(arg, (double) i); - - if(i < 0 || i >= awesomeconf->nlayouts) + if(i < 0 || i >= awesomeconf->nlayouts) + i = 0; + } + else i = 0; awesomeconf->current_layout = &awesomeconf->layouts[i];