Add Panama commands to the launcher
This commit is contained in:
Executable
+95
@@ -0,0 +1,95 @@
|
||||
#!/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)"
|
||||
action="${1:-}"
|
||||
|
||||
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
|
||||
|
||||
report_failure() {
|
||||
local status=$?
|
||||
trap - EXIT
|
||||
if (( status != 0 )) && command -v notify-send >/dev/null 2>&1; then
|
||||
notify-send -a Panama -i dialog-error-symbolic \
|
||||
"Panama action failed" \
|
||||
"The “${action//-/ }” action could not be completed." || true
|
||||
fi
|
||||
exit "$status"
|
||||
}
|
||||
trap report_failure EXIT
|
||||
|
||||
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 "$action" 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
|
||||
@@ -100,8 +100,18 @@ case "${1:-}" in
|
||||
microphone) shift; adjust_microphone "$@" ;;
|
||||
brightness) shift; adjust_brightness "$@" ;;
|
||||
media) shift; media_action "$@" ;;
|
||||
message)
|
||||
shift
|
||||
kind="${1:-}"
|
||||
[[ -n $kind && $# -ge 2 ]] || {
|
||||
printf 'Usage: panama-osd message ICON LABEL\n' >&2
|
||||
exit 2
|
||||
}
|
||||
shift
|
||||
show_message "$kind" "$*"
|
||||
;;
|
||||
*)
|
||||
printf 'Usage: panama-osd volume|microphone|brightness|media ACTION [step]\n' >&2
|
||||
printf 'Usage: panama-osd volume|microphone|brightness|media|message ACTION [value]\n' >&2
|
||||
exit 2
|
||||
;;
|
||||
esac
|
||||
|
||||
@@ -257,6 +257,27 @@ ShellRoot {
|
||||
}
|
||||
}
|
||||
|
||||
// Small stateful controls used by launcher commands. Returning the state
|
||||
// after mutation lets callers give accurate OSD feedback without keeping a
|
||||
// second copy of service state in a shell script.
|
||||
IpcHandler {
|
||||
target: "caffeine"
|
||||
function toggle(): bool {
|
||||
Caffeine.toggle();
|
||||
return Caffeine.enabled;
|
||||
}
|
||||
function status(): bool { return Caffeine.enabled; }
|
||||
}
|
||||
|
||||
IpcHandler {
|
||||
target: "night-light"
|
||||
function toggle(): bool {
|
||||
NightLight.toggle();
|
||||
return NightLight.active;
|
||||
}
|
||||
function status(): bool { return NightLight.active; }
|
||||
}
|
||||
|
||||
IpcHandler {
|
||||
target: "kdeconnect"
|
||||
function fixture(name: string): void { KdeConnect.applyFixture(name); }
|
||||
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
#!/usr/bin/env bash
|
||||
# @vicinae.schemaVersion 1
|
||||
# @vicinae.title Panama: Screenshot and Recording
|
||||
# @vicinae.mode silent
|
||||
# @vicinae.icon ../../icons/hicolor/scalable/apps/panama-settings.svg
|
||||
# @vicinae.description Open the polished screenshot and screen-recording picker.
|
||||
# @vicinae.keywords ["capture", "record", "selection", "window", "screen"]
|
||||
|
||||
exec "$HOME/.config/quickshell/scripts/panama-action" capture
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
#!/usr/bin/env bash
|
||||
# @vicinae.schemaVersion 1
|
||||
# @vicinae.title Panama: End Focus Session
|
||||
# @vicinae.mode silent
|
||||
# @vicinae.icon ../../icons/hicolor/scalable/apps/panama-settings.svg
|
||||
# @vicinae.description End the current focus timer and restore its previous states.
|
||||
# @vicinae.keywords ["stop timer", "deep work", "pomodoro", "restore"]
|
||||
|
||||
exec "$HOME/.config/quickshell/scripts/panama-action" focus-end
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
#!/usr/bin/env bash
|
||||
# @vicinae.schemaVersion 1
|
||||
# @vicinae.title Panama: Open Calendar
|
||||
# @vicinae.mode silent
|
||||
# @vicinae.icon ../../icons/hicolor/scalable/apps/panama-settings.svg
|
||||
# @vicinae.description Open the calendar, synchronized agenda, and ongoing activity.
|
||||
# @vicinae.keywords ["agenda", "events", "appointments", "date", "nextcloud"]
|
||||
|
||||
exec "$HOME/.config/quickshell/scripts/panama-action" calendar
|
||||
@@ -0,0 +1,9 @@
|
||||
#!/usr/bin/env bash
|
||||
# @vicinae.schemaVersion 1
|
||||
# @vicinae.title Panama: Open Clipboard
|
||||
# @vicinae.mode silent
|
||||
# @vicinae.icon ../../icons/hicolor/scalable/apps/panama-settings.svg
|
||||
# @vicinae.description Open Panama's compact clipboard history surface.
|
||||
# @vicinae.keywords ["copy", "paste", "history", "text"]
|
||||
|
||||
exec "$HOME/.config/quickshell/scripts/panama-action" clipboard
|
||||
@@ -0,0 +1,9 @@
|
||||
#!/usr/bin/env bash
|
||||
# @vicinae.schemaVersion 1
|
||||
# @vicinae.title Panama: Open Control Center
|
||||
# @vicinae.mode silent
|
||||
# @vicinae.icon ../../icons/hicolor/scalable/apps/panama-settings.svg
|
||||
# @vicinae.description Open Wi-Fi, Bluetooth, audio, phone, and Home controls.
|
||||
# @vicinae.keywords ["quick settings", "wifi", "bluetooth", "audio", "home", "phone"]
|
||||
|
||||
exec "$HOME/.config/quickshell/scripts/panama-action" control-center
|
||||
@@ -0,0 +1,9 @@
|
||||
#!/usr/bin/env bash
|
||||
# @vicinae.schemaVersion 1
|
||||
# @vicinae.title Panama: Open Mission Control
|
||||
# @vicinae.mode silent
|
||||
# @vicinae.icon ../../icons/hicolor/scalable/apps/panama-settings.svg
|
||||
# @vicinae.description See every workspace, tiled window, and scratchpad window.
|
||||
# @vicinae.keywords ["overview", "workspaces", "windows", "expose", "scratchpad"]
|
||||
|
||||
exec "$HOME/.config/quickshell/scripts/panama-action" overview
|
||||
@@ -0,0 +1,9 @@
|
||||
#!/usr/bin/env bash
|
||||
# @vicinae.schemaVersion 1
|
||||
# @vicinae.title Panama: Open Notifications
|
||||
# @vicinae.mode silent
|
||||
# @vicinae.icon ../../icons/hicolor/scalable/apps/panama-settings.svg
|
||||
# @vicinae.description Open notification history and the unified date center.
|
||||
# @vicinae.keywords ["alerts", "messages", "history", "date center"]
|
||||
|
||||
exec "$HOME/.config/quickshell/scripts/panama-action" notifications
|
||||
@@ -0,0 +1,9 @@
|
||||
#!/usr/bin/env bash
|
||||
# @vicinae.schemaVersion 1
|
||||
# @vicinae.title Panama: Open Prism Gallery
|
||||
# @vicinae.mode silent
|
||||
# @vicinae.icon ../../icons/hicolor/scalable/apps/panama-settings.svg
|
||||
# @vicinae.description Open the living gallery of Panama's production components.
|
||||
# @vicinae.keywords ["design system", "theme", "components", "tokyo night", "style"]
|
||||
|
||||
exec "$HOME/.config/quickshell/scripts/panama-action" gallery
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
#!/usr/bin/env bash
|
||||
# @vicinae.schemaVersion 1
|
||||
# @vicinae.title Panama: Open Settings
|
||||
# @vicinae.mode silent
|
||||
# @vicinae.icon ../../icons/hicolor/scalable/apps/panama-settings.svg
|
||||
# @vicinae.description Configure the Panama desktop from its native Settings app.
|
||||
# @vicinae.keywords ["preferences", "configure", "desktop", "system"]
|
||||
|
||||
exec "$HOME/.config/quickshell/scripts/panama-action" settings
|
||||
@@ -0,0 +1,9 @@
|
||||
#!/usr/bin/env bash
|
||||
# @vicinae.schemaVersion 1
|
||||
# @vicinae.title Panama: Capture Entire Screen
|
||||
# @vicinae.mode silent
|
||||
# @vicinae.icon ../../icons/hicolor/scalable/apps/panama-settings.svg
|
||||
# @vicinae.description Save an immediate screenshot of the complete desktop.
|
||||
# @vicinae.keywords ["quick screenshot", "full screen", "capture", "grim"]
|
||||
|
||||
exec "$HOME/.config/quickshell/scripts/panama-action" screenshot
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
#!/usr/bin/env bash
|
||||
# @vicinae.schemaVersion 1
|
||||
# @vicinae.title Panama: Restart Desktop Shell
|
||||
# @vicinae.mode silent
|
||||
# @vicinae.icon ../../icons/hicolor/scalable/apps/panama-settings.svg
|
||||
# @vicinae.description Restart Quickshell if a desktop surface becomes unresponsive.
|
||||
# @vicinae.keywords ["reload", "repair", "quickshell", "restart", "recover"]
|
||||
|
||||
exec "$HOME/.config/quickshell/scripts/panama-action" restart-shell
|
||||
@@ -0,0 +1,9 @@
|
||||
#!/usr/bin/env bash
|
||||
# @vicinae.schemaVersion 1
|
||||
# @vicinae.title Panama: Screen Intelligence
|
||||
# @vicinae.mode silent
|
||||
# @vicinae.icon ../../icons/hicolor/scalable/apps/panama-settings.svg
|
||||
# @vicinae.description Select part of the screen for OCR, QR, or code recognition.
|
||||
# @vicinae.keywords ["ocr", "text", "qr", "barcode", "recognize", "scan"]
|
||||
|
||||
exec "$HOME/.config/quickshell/scripts/panama-action" intelligence
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
#!/usr/bin/env bash
|
||||
# @vicinae.schemaVersion 1
|
||||
# @vicinae.title Panama: Start Focus Session
|
||||
# @vicinae.mode silent
|
||||
# @vicinae.icon ../../icons/hicolor/scalable/apps/panama-settings.svg
|
||||
# @vicinae.description Start the configured focus timer with DND and Caffeine.
|
||||
# @vicinae.keywords ["timer", "deep work", "pomodoro", "concentrate", "workspace"]
|
||||
|
||||
exec "$HOME/.config/quickshell/scripts/panama-action" focus-start
|
||||
@@ -0,0 +1,9 @@
|
||||
#!/usr/bin/env bash
|
||||
# @vicinae.schemaVersion 1
|
||||
# @vicinae.title Panama: Toggle Caffeine
|
||||
# @vicinae.mode silent
|
||||
# @vicinae.icon ../../icons/hicolor/scalable/apps/panama-settings.svg
|
||||
# @vicinae.description Keep the display awake and block automatic sleep.
|
||||
# @vicinae.keywords ["awake", "sleep", "inhibit", "presentation", "idle"]
|
||||
|
||||
exec "$HOME/.config/quickshell/scripts/panama-action" caffeine
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
#!/usr/bin/env bash
|
||||
# @vicinae.schemaVersion 1
|
||||
# @vicinae.title Panama: Toggle Do Not Disturb
|
||||
# @vicinae.mode silent
|
||||
# @vicinae.icon ../../icons/hicolor/scalable/apps/panama-settings.svg
|
||||
# @vicinae.description Pause or resume notification banners, with OSD confirmation.
|
||||
# @vicinae.keywords ["dnd", "notifications", "quiet", "silence", "alerts"]
|
||||
|
||||
exec "$HOME/.config/quickshell/scripts/panama-action" dnd
|
||||
@@ -0,0 +1,9 @@
|
||||
#!/usr/bin/env bash
|
||||
# @vicinae.schemaVersion 1
|
||||
# @vicinae.title Panama: Toggle Microphone Mute
|
||||
# @vicinae.mode silent
|
||||
# @vicinae.icon ../../icons/hicolor/scalable/apps/panama-settings.svg
|
||||
# @vicinae.description Mute or unmute the default microphone with OSD feedback.
|
||||
# @vicinae.keywords ["mic", "audio input", "privacy", "mute", "unmute"]
|
||||
|
||||
exec "$HOME/.config/quickshell/scripts/panama-action" microphone
|
||||
@@ -0,0 +1,9 @@
|
||||
#!/usr/bin/env bash
|
||||
# @vicinae.schemaVersion 1
|
||||
# @vicinae.title Panama: Toggle Night Light
|
||||
# @vicinae.mode silent
|
||||
# @vicinae.icon ../../icons/hicolor/scalable/apps/panama-settings.svg
|
||||
# @vicinae.description Toggle the warm display color temperature.
|
||||
# @vicinae.keywords ["warm", "temperature", "blue light", "display", "hyprsunset"]
|
||||
|
||||
exec "$HOME/.config/quickshell/scripts/panama-action" night-light
|
||||
Reference in New Issue
Block a user