Unify config into shell.json and add Noctalia plugin support

This commit is contained in:
Ryan Hughes
2026-05-14 02:21:48 -04:00
parent 5c0f5669c9
commit bcbe12b075
49 changed files with 2178 additions and 350 deletions
+5 -4
View File
@@ -3,10 +3,10 @@
# omarchy:summary=Show current monospace font
# omarchy:examples=omarchy font current
bar_config="$HOME/.config/omarchy/bar.json"
shell_config="$HOME/.config/omarchy/shell.json"
if [[ -f $bar_config ]]; then
font_family=$(python3 - "$bar_config" <<'PY'
if [[ -f $shell_config ]]; then
font_family=$(python3 - "$shell_config" <<'PY'
import json
import sys
@@ -16,7 +16,8 @@ try:
except (FileNotFoundError, json.JSONDecodeError):
data = {}
font = data.get("fontFamily") if isinstance(data, dict) else None
bar = data.get("bar") if isinstance(data, dict) else None
font = bar.get("fontFamily") if isinstance(bar, dict) else None
if font:
print(font)
PY
+7 -2
View File
@@ -29,7 +29,7 @@ if [[ -n $font_name ]]; then
sed -i "s/font_family = .*/font_family = $font_name/g" ~/.config/hypr/hyprlock.conf
sed -i "s/font-family: .*/font-family: '$font_name';/g" ~/.config/waybar/style.css
mkdir -p "$HOME/.config/omarchy"
python3 - "$HOME/.config/omarchy/bar.json" "$font_name" <<'PY'
python3 - "$HOME/.config/omarchy/shell.json" "$font_name" <<'PY'
import json
import sys
@@ -42,7 +42,12 @@ try:
except (FileNotFoundError, json.JSONDecodeError):
data = {}
data["fontFamily"] = font_name
data.setdefault("version", 1)
bar = data.get("bar")
if not isinstance(bar, dict):
bar = {}
data["bar"] = bar
bar["fontFamily"] = font_name
with open(path, "w") as file:
json.dump(data, file, indent=2)
+10 -7
View File
@@ -1,17 +1,20 @@
#!/bin/bash
# omarchy:summary=Reset bar user overrides to Omarchy defaults
# omarchy:summary=Reset shell.json to Omarchy defaults
# omarchy:examples=omarchy refresh bar
set -e
OMARCHY_PATH="${OMARCHY_PATH:-$HOME/.local/share/omarchy}"
DEFAULT_CONFIG="$OMARCHY_PATH/config/omarchy/bar.json"
USER_CONFIG="$HOME/.config/omarchy/shell.json"
if [[ ! -f $DEFAULT_CONFIG ]]; then
echo "Missing default bar config at $DEFAULT_CONFIG" >&2
exit 1
# Removing the user file lets the shell fall back to shell-defaults.json on
# its next reload. omarchy-restart-bar (which is now an alias for restarting
# omarchy-shell) reloads the shell so the change takes effect immediately.
if [[ -f $USER_CONFIG ]]; then
backup="$USER_CONFIG.bak.$(date +%s)"
cp "$USER_CONFIG" "$backup"
echo "Backed up user shell config to $backup"
rm -f "$USER_CONFIG"
fi
omarchy-refresh-config omarchy/bar.json
omarchy-restart-bar
+1
View File
@@ -14,6 +14,7 @@ Examples:
omarchy-shell-ipc shell summon omarchy.bar-settings "{}"
omarchy-shell-ipc shell hide omarchy.image-picker
omarchy-shell-ipc shell listPlugins
omarchy-shell-ipc shell listShellConfig
omarchy-shell-ipc shell rescanPlugins
omarchy-shell-ipc image-selector ping
omarchy-shell-ipc image-selector cancel ""
+7 -3
View File
@@ -6,7 +6,7 @@
set -e
CONFIG_FILE="$HOME/.config/omarchy/bar.json"
CONFIG_FILE="$HOME/.config/omarchy/shell.json"
position=$1
if [[ ! $position =~ ^(top|bottom|left|right)$ ]]; then
@@ -17,7 +17,6 @@ fi
mkdir -p "$(dirname "$CONFIG_FILE")"
python3 - "$CONFIG_FILE" "$position" <<'PY'
import json
import os
import sys
path, position = sys.argv[1], sys.argv[2]
@@ -29,7 +28,12 @@ try:
except (FileNotFoundError, json.JSONDecodeError):
data = {}
data["position"] = position
data.setdefault("version", 1)
bar = data.get("bar")
if not isinstance(bar, dict):
bar = {}
data["bar"] = bar
bar["position"] = position
with open(path, "w") as file:
json.dump(data, file, indent=2)