Integrate omarchy menu into shell

This commit is contained in:
Ryan Hughes
2026-05-14 02:25:05 -04:00
parent 7d2745b6a6
commit 0e135bbb75
20 changed files with 2087 additions and 925 deletions
+14 -26
View File
@@ -29,40 +29,28 @@ 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/shell.json" "$font_name" <<'PY'
import json
import sys
shell_config="$HOME/.config/omarchy/shell.json"
tmp=$(mktemp)
path, font_name = sys.argv[1], sys.argv[2]
try:
with open(path) as file:
data = json.load(file)
if not isinstance(data, dict):
data = {}
except (FileNotFoundError, json.JSONDecodeError):
data = {}
if [[ -s $shell_config ]] && jq -e 'type == "object"' "$shell_config" >/dev/null 2>&1; then
jq --arg font_name "$font_name" '
.version = 1 |
.bar = ((.bar // {}) | if type == "object" then . else {} end) |
.bar.fontFamily = $font_name
' "$shell_config" >"$tmp"
else
jq -n --arg font_name "$font_name" '{ version: 1, bar: { fontFamily: $font_name } }' >"$tmp"
fi
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)
file.write("\n")
PY
mv "$tmp" "$shell_config"
sed -i "s/font-family: .*/font-family: '$font_name';/g" ~/.config/swayosd/style.css
xmlstarlet ed -L \
-u '//match[@target="pattern"][test/string="monospace"]/edit[@name="family"]/string' \
-v "$font_name" \
~/.config/fontconfig/fonts.conf
omarchy-restart-waybar
OMARCHY_PATH=${OMARCHY_PATH:-$HOME/.local/share/omarchy}
if quickshell list -p "$OMARCHY_PATH/default/quickshell/omarchy-shell" 2>/dev/null | grep -q '^Instance '; then
omarchy-restart-bar
if pgrep -x waybar >/dev/null; then
omarchy-restart-waybar
fi
omarchy-restart-swayosd
+728 -829
View File
File diff suppressed because it is too large Load Diff
+2 -5
View File
@@ -7,14 +7,11 @@ set -e
USER_CONFIG="$HOME/.config/omarchy/shell.json"
# 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.
# Removing the user file lets the running shell fall back to shell-defaults.json
# via its FileView watcher. The next shell start will also use the defaults.
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-restart-bar
@@ -1,7 +1,7 @@
#!/bin/bash
# omarchy:summary=Restart the bar
# omarchy:examples=omarchy restart bar
# omarchy:summary=Restart Omarchy Quickshell
# omarchy:examples=omarchy restart quickshell | omarchy-restart-quickshell
OMARCHY_PATH=${OMARCHY_PATH:-$HOME/.local/share/omarchy}
CONFIG_DIR="$OMARCHY_PATH/default/quickshell/omarchy-shell"
+11 -24
View File
@@ -15,29 +15,16 @@ if [[ ! $position =~ ^(top|bottom|left|right)$ ]]; then
fi
mkdir -p "$(dirname "$CONFIG_FILE")"
python3 - "$CONFIG_FILE" "$position" <<'PY'
import json
import sys
tmp=$(mktemp)
path, position = sys.argv[1], sys.argv[2]
try:
with open(path) as file:
data = json.load(file)
if not isinstance(data, dict):
data = {}
except (FileNotFoundError, json.JSONDecodeError):
data = {}
if [[ -s $CONFIG_FILE ]] && jq -e 'type == "object"' "$CONFIG_FILE" >/dev/null 2>&1; then
jq --arg position "$position" '
.version = 1 |
.bar = ((.bar // {}) | if type == "object" then . else {} end) |
.bar.position = $position
' "$CONFIG_FILE" >"$tmp"
else
jq -n --arg position "$position" '{ version: 1, bar: { position: $position } }' >"$tmp"
fi
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)
file.write("\n")
PY
omarchy-restart-bar
mv "$tmp" "$CONFIG_FILE"
-4
View File
@@ -53,10 +53,6 @@ fi
if pgrep -x waybar >/dev/null; then
omarchy-restart-waybar
fi
OMARCHY_PATH=${OMARCHY_PATH:-$HOME/.local/share/omarchy}
if quickshell list -p "$OMARCHY_PATH/default/quickshell/omarchy-shell" 2>/dev/null | grep -q '^Instance '; then
omarchy-restart-bar
fi
omarchy-restart-swayosd
omarchy-restart-terminal
omarchy-restart-hyprctl
+3 -4
View File
@@ -20,10 +20,9 @@ if gum confirm "Install Voxtype + AI model (~150MB) to enable dictation?"; then
fi
voxtype setup systemd
omarchy-restart-waybar
OMARCHY_PATH=${OMARCHY_PATH:-$HOME/.local/share/omarchy}
if quickshell list -p "$OMARCHY_PATH/default/quickshell/omarchy-shell" 2>/dev/null | grep -q '^Instance '; then
omarchy-restart-bar
if pgrep -x waybar >/dev/null; then
omarchy-restart-waybar
fi
omarchy-restart-quickshell
notify-send " Voxtype Dictation Ready" "Hold F9 to dictate (or toggle with Super + Ctrl + X)." -t 10000
fi
+3 -4
View File
@@ -5,8 +5,7 @@
set -e
omarchy-launch-floating-terminal-with-presentation "voxtype setup model"
omarchy-restart-waybar
OMARCHY_PATH=${OMARCHY_PATH:-$HOME/.local/share/omarchy}
if quickshell list -p "$OMARCHY_PATH/default/quickshell/omarchy-shell" 2>/dev/null | grep -q '^Instance '; then
omarchy-restart-bar
if pgrep -x waybar >/dev/null; then
omarchy-restart-waybar
fi
omarchy-restart-quickshell