swadhinbiswas Initial de-omarchy: Omarchy UI layer for Arch-based distros · 8/22/2026
9f393b2
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
#!/bin/bash
# omarchy:summary=Enable a shell plugin
# omarchy:group=plugin
# omarchy:args=<id> [placement]
# omarchy:examples=omarchy plugin enable acme.weather --section right
set -euo pipefail
fail() {
echo "omarchy-plugin-enable: $*" >&2
exit 1
}
if [[ ${1:-} == "-h" || ${1:-} == "--help" ]]; then
echo "Usage: omarchy plugin enable <id> [placement]"
exit 0
fi
id="${1:-}"
[[ -n $id ]] || fail "plugin id is required"
shift
if (( $# > 0 )) && omarchy-plugin-catalog | jq -e --arg id "$id" '
any(.[]; .id == $id and (.kinds | index("bar")))
' >/dev/null; then
fail "'$id' is a bar; it replaces the bar in use rather than taking a place in one"
fi
section=""
index=""
before=""
after=""
if (( $# > 0 )) && [[ $1 != --* ]]; then
section="$1"
shift
fi
while (( $# > 0 )); do
case "$1" in
--section)
[[ -z $section ]] || fail "specify a section positionally or with --section, not both"
section="${2:-}"
[[ -n $section ]] || fail "--section requires a section"
shift 2
;;
--index)
index="${2:-}"
[[ -n $index ]] || fail "--index requires an index"
shift 2
;;
--before)
before="${2:-}"
[[ -n $before ]] || fail "--before requires a widget id"
shift 2
;;
--after)
after="${2:-}"
[[ -n $after ]] || fail "--after requires a widget id"
shift 2
;;
*)
fail "unknown placement option: $1"
;;
esac
done
[[ -z $section || $section =~ ^(left|center|right)$ ]] ||
fail "section must be left, center, or right"
[[ -z $index || $index =~ ^[0-9]+$ ]] ||
fail "index must be a non-negative integer"
[[ -z $before || -z $after ]] || fail "use only one of --before or --after"
placement=$(jq -cn \
--arg section "$section" \
--arg index "$index" \
--arg before "$before" \
--arg after "$after" '
{}
+ (if $section == "" then {} else {section: $section} end)
+ (if $index == "" then {} else {index: ($index | tonumber)} end)
+ (if $before == "" then {} else {before: $before} end)
+ (if $after == "" then {} else {after: $after} end)
')
result=$(omarchy-shell shell enablePlugin "$id" "$placement")
if [[ $result == "unknown" ]]; then
fail "plugin '$id' is not known; run: omarchy-shell shell rescanPlugins"
elif [[ $result != "ok" ]]; then
fail "$result"
fi
if [[ $placement != "{}" ]]; then
echo "Enabled and moved $id"
elif omarchy-plugin-catalog | jq -e --arg id "$id" '
any(.[]; .id == $id and (.kinds | index("bar")))
' >/dev/null; then
echo "Now using $id as the bar"
else
echo "Enabled $id"
fi