layout toggle: take any combination of layouts as arguments (#2649)

With this PR the 'layout toggle' command can be passed any
combination of valid layout keywords as arguments. They will
be activated one after another each time you issue the command,
advancing from left to right always selecting the layout after
the currently active layout or the leftmost layout if the active
layout is not in the argument list.

This PR also incorporates the feature request from #2476.
This commit is contained in:
s3rb31
2017-01-19 20:49:56 +01:00
parent 3410cb256d
commit 37658bd6d7
5 changed files with 143 additions and 20 deletions

View File

@ -1802,7 +1802,8 @@ The +toggle+ option will toggle the orientation of the split container if it
contains a single window. Otherwise it makes the current window a split
container with opposite orientation compared to the parent container.
Use +layout toggle split+ to change the layout of any split container from
splitv to splith or vice-versa.
splitv to splith or vice-versa. You can also define a custom sequence of layouts
to cycle through with +layout toggle+, see <<manipulating_layout>>.
*Syntax*:
--------------------------------
@ -1822,6 +1823,11 @@ Use +layout toggle split+, +layout stacking+, +layout tabbed+, +layout splitv+
or +layout splith+ to change the current container layout to splith/splitv,
stacking, tabbed layout, splitv or splith, respectively.
Specify up to four layouts after +layout toggle+ to cycle through them. Every
time the command is executed, the layout specified after the currently active
one will be applied. If the currently active layout is not in the list, the
first layout in the list will be activated.
To make the current window (!) fullscreen, use +fullscreen enable+ (or
+fullscreen enable global+ for the global mode), to leave either fullscreen
mode use +fullscreen disable+, and to toggle between these two states use
@ -1834,6 +1840,7 @@ enable+ respectively +floating disable+ (or +floating toggle+):
--------------------------------------------
layout default|tabbed|stacking|splitv|splith
layout toggle [split|all]
layout toggle [split|tabbed|stacking|splitv|splith] [split|tabbed|stacking|splitv|splith]…
--------------------------------------------
*Examples*:
@ -1848,6 +1855,15 @@ bindsym $mod+x layout toggle
# Toggle between stacking/tabbed/splith/splitv:
bindsym $mod+x layout toggle all
# Toggle between stacking/tabbed/splith:
bindsym $mod+x layout toggle stacking tabbed splith
# Toggle between splitv/tabbed
bindsym $mod+x layout toggle splitv tabbed
# Toggle between last split layout/tabbed/stacking
bindsym $mod+x layout toggle split tabbed stacking
# Toggle fullscreen
bindsym $mod+f fullscreen toggle