/ de-omarchy / bin / omarchy-menu
swadhinbiswas Initial de-omarchy: Omarchy UI layer for Arch-based distros · 8/22/2026
9f393b2
53 lines · 1.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/bin/bash

# omarchy:summary=Control the Omarchy menu (toggle / summon / close / refresh)
# 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 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() {
  jq -nc --arg menu "$1" '{ menu: $menu }'
}

case "$verb" in
  toggle)
    exec omarchy-shell shell toggle omarchy.menu "$(menu_payload "$route")"
    ;;
  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
Usage: omarchy menu [verb] [route]

Verbs:
  toggle [route]   Open the menu at <route>, or close it if already open. Default verb.
  summon [route]   Always open the menu (no close-if-visible toggle).
  close            Close the menu if it is visible.
  refresh          Re-parse the menu JSONC files.
  ping             Health check.

Route is an item id (e.g. setup.power) or alias (e.g. power). Defaults to
"root", which opens the top-level menu.
USAGE
    exit 0
    ;;
  *)
    echo "omarchy-menu: unknown verb '$verb'. Try 'omarchy menu --help'." >&2
    exit 2
    ;;
esac