[Enhancement] Add way to explicitly show/hide special workspace (rather than 'toggle') #8594
Description
The Problem
The dispatcher togglespecialworkspace
has no (documented) way of always-showing, or always-hiding, a workspace. It can only toggle the visibility between shown/hidden.
I am looking for a method with this behaviour:
- If the given special workspace is hidden, then show it
- Else do nothing (the given special workspace is already shown)
...and the inversely to hide it.
Possible Solution 1
The dispatcher togglespecialworkspace
could take an optional second parameter for the desired action (toggle
, show
, or hide
). I believe this is compatible with the current API.
# Default: `toggle`
hyprctl dispatch togglespecialworkspace magic
hyprctl dispatch togglespecialworkspace magic, toggle
# New behaviour
hyprctl dispatch togglespecialworkspace magic, show
hyprctl dispatch togglespecialworkspace magic, hide
Possible Solution 2
Alternatively, two new dispatchers could be introduced. I would imagine this is less favorable as it increases the amount of dispatchers.
hyprctl dispatch hidespecialworkspace magic
hyprctl dispatch showspecialworkspace magic
Possible Solution 3
Another alternative could be a way to request the visibility state of a specific special workspace. If this is already possible, I could not find a way to do it.
Maybe hyprctl workspaces
could list a visible: 0/1
value for special workspaces?
hyprctl workspaces -j | jq '.[] | select(.name == "special:<NAME>") | .visible'
# Prints `0` or `1` (or nothing, if `<NAME>` is not the name of a special workspace)
hyprctl activeworkspace
never returns the name of a special workspace, even if a special workspace is active and focused. Is this intended behviour? If not, I will open a new issue for that.
Current Workaround
To hide the current special workspace (and hence hide all special workspaces), the user can show, and immediately hide, a non-existent empty special workspace (named __TEMP
here).
hyprctl dispatch togglespecialworkspace __TEMP
hyprctl dispatch togglespecialworkspace __TEMP
To show a special workspace: hide all special workspaces (as shown above), and then toggle the desired workspace.
hyprctl dispatch togglespecialworkspace __TEMP
hyprctl dispatch togglespecialworkspace __TEMP
hyprctl dispatch togglespecialworkspace <NAME>