Files
omarchycn/bin/omarchy-style-bar-position
T
Ryan Hughes 883d8554f3 Polish first-party shell plugin docs, Hyprland rules, and bar-position seed
- omarchy-bar-settings.lua is gone: the Hyprland rules it carried for
    the old standalone bar-settings window no longer match anything,
    since settings is now a panel plugin summoned via IPC. The still-
    needed "Widget settings" sub-dialog rules move into
    omarchy-shell.lua next to the existing "Omarchy Settings" rules.

  - plugins README documents the `bar` plugin kind so third-party
    plugin authors aren't surprised to see it on the first-party
    omarchy.bar manifest. The note also calls out that they should ship
    `bar-widget`s, not replace the host bar.

  - omarchy-style-bar-position seeds from shell-defaults.json before
    mutating, so a user without a shell.json (or with a malformed one)
    no longer ends up with a stub config that blanks the bar layout.
2026-05-14 16:34:32 -04:00

38 lines
1.1 KiB
Bash
Executable File

#!/bin/bash
# omarchy:summary=Set bar position
# omarchy:args=<top|bottom|left|right>
# omarchy:examples=omarchy-style-bar-position top | omarchy style bar position bottom
set -e
CONFIG_FILE="$HOME/.config/omarchy/shell.json"
DEFAULTS_FILE="${OMARCHY_PATH:-$HOME/.local/share/omarchy}/default/quickshell/omarchy-shell/shell-defaults.json"
position=$1
if [[ ! $position =~ ^(top|bottom|left|right)$ ]]; then
echo "Usage: omarchy-style-bar-position top|bottom|left|right" >&2
exit 1
fi
mkdir -p "$(dirname "$CONFIG_FILE")"
tmp=$(mktemp)
# Seed from shell-defaults.json when the user has no shell.json yet (or it's
# malformed). Writing just `{ bar: { position } }` would leave the bar with
# no layout, since the shell treats any valid user config as authoritative
# and does not deep-merge defaults.
if [[ -s $CONFIG_FILE ]] && jq -e 'type == "object"' "$CONFIG_FILE" >/dev/null 2>&1; then
source="$CONFIG_FILE"
else
source="$DEFAULTS_FILE"
fi
jq --arg position "$position" '
.version = 1 |
.bar = ((.bar // {}) | if type == "object" then . else {} end) |
.bar.position = $position
' "$source" >"$tmp"
mv "$tmp" "$CONFIG_FILE"