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
+6
View File
@@ -18,6 +18,12 @@ if test "$argv[1]" = shell
exit
end
if test "$argv[1]" = toggle
set -l valid_toggles communication music sysmon specialws
contains "$argv[2]" $valid_toggles && ./toggles/$argv[2].fish || error "Invalid toggle: $argv[2]"
exit
end
if test "$argv[1]" = screenshot
./screenshot.fish $argv[2..]
exit
+12
View File
@@ -0,0 +1,12 @@
#!/bin/fish
. (dirname (status filename))/util.fish
spawn-or-move '.class == "vesktop"' communication vesktop --enable-features=WebRTCPipeWireCapturer
# Has whatsapp firefox profile
if grep -q 'Name=whatsapp' ~/.mozilla/firefox/profiles.ini
spawn-or-move '.class == "whatsapp"' communication firefox --name whatsapp -P whatsapp 'https://web.whatsapp.com'
end
hyprctl dispatch togglespecialworkspace communication
+8
View File
@@ -0,0 +1,8 @@
#!/bin/fish
. (dirname (status filename))/util.fish
move-client '.class == "feishin"' music
move-client '.class == "Spotify" or .initialTitle == "Spotify" or .initialTitle == "Spotify Free"' music
hyprctl dispatch togglespecialworkspace music
+10
View File
@@ -0,0 +1,10 @@
#!/bin/fish
if ! hyprctl workspaces -j | jq -e 'first(.[] | select(.name == "special:special"))'
set activews (hyprctl activewindow -j | jq -r '.workspace.name')
string match -r -- '^special:' $activews && set togglews (string sub -s 9 $activews) || set togglews special
else
set togglews special
end
hyprctl dispatch togglespecialworkspace $togglews
+7
View File
@@ -0,0 +1,7 @@
#!/bin/fish
. (dirname (status filename))/util.fish
spawn-client '.class == "btop" and .title == "btop" and .workspace.name == "special:sysmon"' foot -a 'btop' -T 'btop' btop
hyprctl dispatch togglespecialworkspace sysmon
+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