Use plugin IPC routes
This commit is contained in:
+18
-7
@@ -4,19 +4,30 @@
|
||||
# omarchy:args=[toggle|summon|close|refresh|ping] [route]
|
||||
# omarchy:examples=omarchy menu | omarchy menu toggle system | omarchy menu summon style.theme | omarchy menu refresh
|
||||
|
||||
# Thin wrapper around `omarchy-shell menu`. Keybinds and the bar icon
|
||||
# call omarchy-shell directly to skip the omarchy-CLI dispatch hop;
|
||||
# this exists so humans get `omarchy menu toggle X` etc.
|
||||
# Thin wrapper around the standard plugin IPC surface. The menu is the
|
||||
# first-party `omarchy.menu` plugin; routes are passed as JSON payload.
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
verb="${1-toggle}"
|
||||
route="${2-root}"
|
||||
|
||||
menu_payload() {
|
||||
perl -MEncode=decode -MJSON::PP=encode_json -e 'print encode_json({ menu => decode("UTF-8", $ARGV[0]) })' "$1"
|
||||
}
|
||||
|
||||
case "$verb" in
|
||||
toggle | summon)
|
||||
exec omarchy-shell menu "$verb" "$route"
|
||||
toggle)
|
||||
exec omarchy-shell shell toggle omarchy.menu "$(menu_payload "$route")"
|
||||
;;
|
||||
close | refresh | ping)
|
||||
exec omarchy-shell menu "$verb"
|
||||
summon)
|
||||
exec omarchy-shell shell summon omarchy.menu "$(menu_payload "$route")"
|
||||
;;
|
||||
close)
|
||||
exec omarchy-shell shell hide omarchy.menu
|
||||
;;
|
||||
refresh | ping)
|
||||
exec omarchy-shell shell call omarchy.menu "$verb" "{}"
|
||||
;;
|
||||
-h | --help | help)
|
||||
cat <<USAGE
|
||||
|
||||
@@ -2,4 +2,4 @@
|
||||
|
||||
# omarchy:summary=Toggle the current weather panel
|
||||
|
||||
omarchy-shell Weather toggle
|
||||
omarchy-shell omarchy.weather toggle
|
||||
|
||||
+2
-2
@@ -2,7 +2,7 @@
|
||||
|
||||
# omarchy:summary=Send an IPC call to the running Omarchy shell
|
||||
# omarchy:args=[-q] <target> <method> [args...]
|
||||
# omarchy:examples=omarchy shell shell ping | omarchy-shell menu toggle root
|
||||
# omarchy:examples=omarchy shell shell ping | omarchy-shell shell toggle omarchy.menu '{"menu":"root"}'
|
||||
|
||||
QUIET=0
|
||||
if [[ ${1:-} == "-q" ]]; then
|
||||
@@ -26,7 +26,7 @@ Examples:
|
||||
omarchy-shell shell summon omarchy.settings "{}"
|
||||
omarchy-shell -q Indicators refresh
|
||||
omarchy-shell shell listPlugins
|
||||
omarchy-shell menu toggle root
|
||||
omarchy-shell shell toggle omarchy.menu '{"menu":"root"}'
|
||||
USAGE
|
||||
exit 0
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user