action: add toggle for GoToDesktop

Adds an option "toogle" to GoToDesktop.
In case the target is already where we are, we go back to the last desktop
instead.

Example of rc.xml

<keybind key="C-F1">
  <action name="GoToDesktop">
    <to>1</to>
    <toggle>yes</toggle>
  </action>
</keybind>
This commit is contained in:
Rainer Kuemmerle 2025-03-08 19:28:57 +01:00 committed by Johan Malm
parent 55ee96761a
commit 657c08aaa1
2 changed files with 16 additions and 1 deletions

View file

@ -278,7 +278,7 @@ Actions are used in menus and keyboard/mouse bindings.
Resizes active window size to width and height of the output when the
window size exceeds the output size.
*<action name="GoToDesktop" to="value" wrap="yes" />*
*<action name="GoToDesktop" to="value" wrap="yes" toggle="no" />*
Switch to workspace.
*to* The workspace to switch to. Supported values are "current", "last",
@ -288,6 +288,9 @@ Actions are used in menus and keyboard/mouse bindings.
*wrap* [yes|no] Wrap around from last desktop to first, and vice
versa. Default yes.
*toggle* [yes|no] Toggle to “last” if already on the workspace that
would be the actual destination. Default no.
*<action name="SendToDesktop" to="value" follow="yes" wrap="yes" />*
Send active window to workspace.