toggles: refactor to have config

Config is in $XDG_CONFIG_HOME/caelestia/scripts.json
Selector is a jq selector using hyprland client data
Spawn is a command passed to uwsm app
Action is either spawn, move, or both
Extra cond is an extra shell command to check whether to do action (for easy disabling just put false or empty action)
This commit is contained in:
2 * r + 2 * t
2025-04-03 21:41:26 +11:00
parent 9464e34727
commit f8a6e84aa9
8 changed files with 107 additions and 40 deletions
+11 -1
View File
@@ -20,7 +20,17 @@ end
if test "$argv[1]" = toggle
set -l valid_toggles communication music sysmon specialws todo
contains -- "$argv[2]" $valid_toggles && $src/toggles/$argv[2].fish || error "Invalid toggle: $argv[2]"
if contains -- "$argv[2]" $valid_toggles
if $argv[2] = specialws
$src/toggles/specialws.fish
else
. $src/toggles/util.fish
toggle-workspace $argv[2]
end
else
error "Invalid toggle: $argv[2]"
end
exit
end