diff --git a/awesomerc b/awesomerc index c8b73ed99..ecc07de8a 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 9d1b41ac0..96abdf663 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];