Add Panama commands to the launcher

This commit is contained in:
Gabriel Brown
2026-08-18 07:10:32 -04:00
parent d1b2cd2083
commit 3e8aaf2b2d
28 changed files with 641 additions and 2 deletions
+82
View File
@@ -0,0 +1,82 @@
#!/usr/bin/env bash
# One stable command boundary for launcher actions. Vicinae scripts stay tiny,
# while the actual mapping to Quickshell IPC remains testable in one place.
set -euo pipefail
script_dir="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)"
if command -v panama-osd >/dev/null 2>&1; then
osd_command=(panama-osd)
else
osd_command=("$script_dir/panama-osd")
fi
if command -v panama-prism-gallery >/dev/null 2>&1; then
gallery_command=(panama-prism-gallery)
else
gallery_command=("$script_dir/panama-prism-gallery")
fi
show_state() {
local state="$1" on_icon="$2" off_icon="$3" label="$4"
case "$state" in
true) "${osd_command[@]}" message "$on_icon" "$label On" ;;
false) "${osd_command[@]}" message "$off_icon" "$label Off" ;;
*)
printf 'Panama action returned an invalid state: %s\n' "$state" >&2
return 1
;;
esac
}
toggle_state() {
local target="$1" on_icon="$2" off_icon="$3" label="$4" state
state="$(qs ipc call "$target" toggle)"
show_state "$state" "$on_icon" "$off_icon" "$label"
}
case "${1:-}" in
control-center) qs ipc call quicksettings open ;;
notifications) qs ipc call notifications open ;;
calendar) qs ipc call calendar-agenda open ;;
clipboard) qs ipc call clipboard open ;;
overview) qs ipc call overview open ;;
settings) qs ipc call settings open ;;
dnd)
state="$(qs ipc call notifications dnd)"
show_state "$state" notifications-disabled-symbolic notifications-symbolic "Do Not Disturb"
;;
caffeine)
toggle_state caffeine weather-clear-symbolic weather-clear-night-symbolic Caffeine
;;
night-light)
toggle_state night-light night-light-symbolic night-light-disabled-symbolic "Night Light"
;;
focus-start)
qs ipc call focus start
"${osd_command[@]}" message preferences-system-time-symbolic "Focus Session Started"
;;
focus-end)
qs ipc call focus end
"${osd_command[@]}" message media-playback-stop-symbolic "Focus Session Ended"
;;
capture) qs ipc call capture open ;;
intelligence) qs ipc call screen-intelligence open ;;
screenshot) qs ipc call capture screenNow ;;
microphone) "${osd_command[@]}" microphone toggle ;;
gallery) "${gallery_command[@]}" ;;
restart-shell)
qs kill
quickshell --daemonize
;;
*)
printf 'Usage: panama-action {%s}\n' \
'control-center|notifications|calendar|clipboard|overview|settings|dnd|caffeine|night-light|focus-start|focus-end|capture|intelligence|screenshot|microphone|gallery|restart-shell' >&2
exit 2
;;
esac