main: special workspace toggles

This commit is contained in:
2 * r + 2 * t
2025-01-17 17:54:37 +11:00
parent 02c194f68c
commit ee9977c267
6 changed files with 64 additions and 0 deletions
+21
View File
@@ -0,0 +1,21 @@
function move-client -a selector -a workspace
if hyprctl -j clients | jq -e 'first(.[] | select('$selector')).workspace.name != "special:'$workspace'"' > /dev/null
# Window not in correct workspace
set -l window_addr (hyprctl -j clients | jq -r 'first(.[] | select('$selector')).address')
hyprctl dispatch movetoworkspacesilent "special:$workspace,address:$window_addr"
end
end
function spawn-client -a selector
# Spawn if doesn't exist
hyprctl -j clients | jq -e "first(.[] | select($selector))" > /dev/null
set -l stat $status
if test $stat != 0
uwsm app -- $argv[2..] & disown
end
return $stat
end
function spawn-or-move -a selector -a workspace
spawn-client $selector $argv[3..] || move-client $selector $workspace
end