Restore service widgets with bar defaults
This commit is contained in:
+25
-1
@@ -2,7 +2,7 @@
|
||||
|
||||
# omarchy:summary=Mutate the user shell.json bar layout, active bar option, and bar settings
|
||||
# omarchy:group=bar
|
||||
# omarchy:args=show | layout [--json] | list [--json] [--all] | options [--json] | use <plugin> | reset | add [plugin] [placement] | move <plugin> [placement] | remove [plugin] [placement] | set <plugin> <key> <value> [--json] [placement] | replace <old> <new> | position <top|bottom|left|right> | transparent <true|false> | settings
|
||||
# omarchy:args=show | layout [--json] | list [--json] [--all] | options [--json] | use <plugin> | reset | defaults | add [plugin] [placement] | move <plugin> [placement] | remove [plugin] [placement] | set <plugin> <key> <value> [--json] [placement] | replace <old> <new> | position <top|bottom|left|right> | transparent <true|false> | settings
|
||||
# omarchy:examples=omarchy bar show | omarchy bar list | omarchy bar add omarchy.tailscale | omarchy bar add omarchy.clock --section center --before omarchy.weather | omarchy bar move omarchy.clock --section center --index 0 | omarchy bar remove omarchy.tailscale | omarchy bar set omarchy.clock format HH:mm | omarchy bar use local.neon-bar | omarchy bar position top | omarchy bar transparent true
|
||||
|
||||
set -euo pipefail
|
||||
@@ -24,6 +24,7 @@ Inspect:
|
||||
Select:
|
||||
use <id> Use a bar option as the active bar
|
||||
reset Return to the built-in Omarchy bar
|
||||
defaults Restore the default bar and service widgets
|
||||
|
||||
Edit layout:
|
||||
add <id> [placement] Add a bar widget
|
||||
@@ -68,6 +69,7 @@ Examples:
|
||||
omarchy bar set omarchy.indicators items '["Dnd","NightLight"]' --json
|
||||
omarchy bar use local.neon-bar
|
||||
omarchy bar reset
|
||||
omarchy bar defaults
|
||||
omarchy bar position top
|
||||
omarchy bar transparent true
|
||||
USAGE
|
||||
@@ -504,6 +506,25 @@ cmd_reset() {
|
||||
echo "Reset to the built-in Omarchy bar"
|
||||
}
|
||||
|
||||
cmd_defaults() {
|
||||
local service
|
||||
local services=(dropbox tailscale)
|
||||
|
||||
(( $# == 0 )) || fail "defaults does not take arguments"
|
||||
require_omarchy_path
|
||||
[[ -s $DEFAULTS_FILE ]] || fail "could not find bar defaults"
|
||||
|
||||
commit "$JQ_DEFS $NORMALIZE | .bar = \$defaults[0].bar" --slurpfile defaults "$DEFAULTS_FILE"
|
||||
|
||||
for service in "${services[@]}"; do
|
||||
if "omarchy-installed-service-$service"; then
|
||||
cmd_add "omarchy.$service"
|
||||
fi
|
||||
done
|
||||
|
||||
echo "Restored the default Omarchy bar"
|
||||
}
|
||||
|
||||
# --------------------------------------------------------------- commands: edit
|
||||
|
||||
cmd_add() {
|
||||
@@ -812,6 +833,9 @@ case "$command" in
|
||||
reset)
|
||||
cmd_reset "$@"
|
||||
;;
|
||||
defaults)
|
||||
cmd_defaults "$@"
|
||||
;;
|
||||
add)
|
||||
cmd_add "$@"
|
||||
;;
|
||||
|
||||
@@ -6,13 +6,6 @@
|
||||
set -euo pipefail
|
||||
|
||||
omarchy-refresh-config omarchy/shell.json
|
||||
|
||||
if omarchy-installed-service-dropbox; then
|
||||
omarchy-bar add omarchy.dropbox
|
||||
fi
|
||||
|
||||
if omarchy-installed-service-tailscale; then
|
||||
omarchy-bar add omarchy.tailscale
|
||||
fi
|
||||
omarchy-bar defaults
|
||||
|
||||
omarchy-restart-shell
|
||||
|
||||
@@ -2326,6 +2326,13 @@ cleanup_legacy_user_paths
|
||||
apply_system_transition
|
||||
suppress_hyprland_config_reload
|
||||
apply_user_transition
|
||||
run_as_user env \
|
||||
HOME="$target_home" \
|
||||
USER="$target_user" \
|
||||
LOGNAME="$target_user" \
|
||||
OMARCHY_PATH=/usr/share/omarchy \
|
||||
PATH="$package_path" \
|
||||
omarchy-bar defaults
|
||||
cleanup_retired_services
|
||||
ensure_sleep_lock_service
|
||||
remove_retired_default_packages
|
||||
|
||||
@@ -343,6 +343,21 @@ SH
|
||||
chmod +x "$mock_bin"/*
|
||||
mock_path="$mock_bin:$ROOT/bin:$PATH"
|
||||
|
||||
HOME="$TMPDIR/home" OMARCHY_PATH="$ROOT" PATH="$mock_path" OMARCHY_TEST_DROPBOX=0 OMARCHY_TEST_TAILSCALE=0 omarchy-bar defaults
|
||||
jq -e --slurpfile defaults "$ROOT/config/omarchy/shell.json" '
|
||||
.bar == $defaults[0].bar and
|
||||
.plugins == []
|
||||
' "$TMPDIR/home/.config/omarchy/shell.json" >/dev/null
|
||||
pass "bar defaults restores the stock bar"
|
||||
|
||||
HOME="$TMPDIR/home" OMARCHY_PATH="$ROOT" PATH="$mock_path" OMARCHY_TEST_DROPBOX=1 OMARCHY_TEST_TAILSCALE=1 omarchy-bar defaults
|
||||
jq -e '
|
||||
def ids: map(.id // .);
|
||||
(.bar.layout.right | ids | index("omarchy.dropbox") != null) and
|
||||
(.bar.layout.right | ids | index("omarchy.tailscale") != null)
|
||||
' "$TMPDIR/home/.config/omarchy/shell.json" >/dev/null
|
||||
pass "bar defaults adds widgets for running optional services"
|
||||
|
||||
HOME="$TMPDIR/home" OMARCHY_PATH="$ROOT" PATH="$mock_path" OMARCHY_TEST_DROPBOX=0 OMARCHY_TEST_TAILSCALE=0 omarchy-refresh-shell
|
||||
jq -e '
|
||||
def ids: map(.id // .);
|
||||
|
||||
@@ -47,3 +47,6 @@ grep -F 'systemd-networkd.service' "$upgrade_to_quattro" >/dev/null
|
||||
grep -F 'systemd-networkd.socket' "$upgrade_to_quattro" >/dev/null
|
||||
grep -F 'systemd-networkd-resolve-hook.socket' "$upgrade_to_quattro" >/dev/null
|
||||
pass "Omarchy 4 upgrade retires systemd-networkd for NetworkManager"
|
||||
|
||||
grep -F 'omarchy-bar defaults' "$upgrade_to_quattro" >/dev/null
|
||||
pass "Omarchy 4 upgrade restores service-aware bar defaults"
|
||||
|
||||
Reference in New Issue
Block a user