mirror of
https://github.com/caelestia-dots/cli.git
synced 2026-06-05 14:59:29 -05:00
main: special workspace toggles
This commit is contained in:
@@ -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
|
||||
|
||||
Executable
+12
@@ -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
|
||||
Executable
+8
@@ -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
|
||||
Executable
+10
@@ -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
|
||||
Executable
+7
@@ -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
|
||||
@@ -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
|
||||
Reference in New Issue
Block a user