Replace bar-settings with unified settings plugin
Consolidates bar-settings into a single 'settings' plugin with sidebar categories: Defaults, Style, Bar, System, Plugins. Updates supporting commands (omarchy-launch-settings, omarchy-style-corners-quickshell, omarchy-theme-list-with-previews, omarchy-hyprland-monitor-scaling-set) and refreshes sidebar glyphs to Nerd Font icons.
This commit is contained in:
@@ -1,20 +1,15 @@
|
||||
#!/bin/bash
|
||||
|
||||
# omarchy:summary=Cycle focused Hyprland monitor scaling through 1x, 1.25x, 1.6x, 2x, 3x, and 4x
|
||||
# omarchy:args=[--reverse]
|
||||
# omarchy:examples=omarchy-hyprland-monitor-scaling-cycle | omarchy-hyprland-monitor-scaling-cycle --reverse
|
||||
|
||||
MONITOR_INFO=$(hyprctl monitors -j | jq -r '.[] | select(.focused == true)')
|
||||
ACTIVE_MONITOR=$(echo "$MONITOR_INFO" | jq -r '.name')
|
||||
CURRENT_SCALE=$(echo "$MONITOR_INFO" | jq -r '.scale')
|
||||
WIDTH=$(echo "$MONITOR_INFO" | jq -r '.width')
|
||||
HEIGHT=$(echo "$MONITOR_INFO" | jq -r '.height')
|
||||
REFRESH_RATE=$(echo "$MONITOR_INFO" | jq -r '.refreshRate')
|
||||
CURRENT_SCALE=$(hyprctl monitors -j | jq -r '.[] | select(.focused == true) | .scale')
|
||||
|
||||
# Cycle through monitor/GDK scale pairs: 1 → 1.25 → 1.6 → 2 → 3 → 4 → 1 (or reverse with --reverse)
|
||||
SCALES=(1 1.25 1.6 2 3 4)
|
||||
GDK_SCALES=(1 1.25 1.75 2 3 4)
|
||||
|
||||
# Find the index of the scale closest to the current one (Hyprland may
|
||||
# snap fractional scales to nearby values, so we can't match exactly)
|
||||
# snap fractional scales to nearby values, so we can't match exactly).
|
||||
CURRENT_IDX=$(awk -v s="$CURRENT_SCALE" -v list="${SCALES[*]}" 'BEGIN {
|
||||
n = split(list, arr, " ")
|
||||
best = 0; best_diff = 1e9
|
||||
@@ -31,24 +26,4 @@ else
|
||||
NEW_IDX=$(( (CURRENT_IDX + 1) % ${#SCALES[@]} ))
|
||||
fi
|
||||
|
||||
NEW_SCALE=${SCALES[$NEW_IDX]}
|
||||
NEW_GDK_SCALE=${GDK_SCALES[$NEW_IDX]}
|
||||
|
||||
hyprctl eval "hl.monitor({ output = \"$ACTIVE_MONITOR\", mode = \"${WIDTH}x${HEIGHT}@${REFRESH_RATE}\", position = \"auto\", scale = $NEW_SCALE })" >/dev/null
|
||||
|
||||
# Persist to monitors.lua if the user still has Omarchy's generic catch-all
|
||||
# defaults, so the scale survives reboots.
|
||||
MONITOR_LUA="$HOME/.config/hypr/monitors.lua"
|
||||
if [[ -f $MONITOR_LUA ]] && grep -q '^local omarchy_monitor_scale = ' "$MONITOR_LUA"; then
|
||||
sed -i -E \
|
||||
-e "s|^local omarchy_monitor_scale = .*|local omarchy_monitor_scale = ${NEW_SCALE}|" \
|
||||
-e "s|^local omarchy_gdk_scale = .*|local omarchy_gdk_scale = ${NEW_GDK_SCALE}|" \
|
||||
"$MONITOR_LUA"
|
||||
elif [[ -f $MONITOR_LUA ]] && grep -Eq '^hl\.monitor\(\{ output = "", mode = "preferred", position = "auto", scale = ("auto"|[0-9.]+) \}\)' "$MONITOR_LUA"; then
|
||||
sed -i -E \
|
||||
-e "s|^(hl\.monitor\(\{ output = \"\", mode = \"preferred\", position = \"auto\", scale = )([^ ]+)( \}\))|\\1${NEW_SCALE}\\3|" \
|
||||
-e 's|^hl\.env\("GDK_SCALE", ".*"\)|hl.env("GDK_SCALE", "'"$NEW_GDK_SCALE"'")|' \
|
||||
"$MONITOR_LUA"
|
||||
fi
|
||||
|
||||
notify-send -u low " Display scaling set to ${NEW_SCALE}x"
|
||||
exec omarchy-hyprland-monitor-scaling-set "${SCALES[$NEW_IDX]}"
|
||||
|
||||
Executable
+45
@@ -0,0 +1,45 @@
|
||||
#!/bin/bash
|
||||
|
||||
# omarchy:summary=Set focused Hyprland monitor scaling to a specific value
|
||||
# omarchy:args=<1|1.25|1.6|2|3|4>
|
||||
# omarchy:examples=omarchy-hyprland-monitor-scaling-set 1.6 | omarchy-hyprland-monitor-scaling-set 2
|
||||
|
||||
NEW_SCALE="$1"
|
||||
|
||||
case "$NEW_SCALE" in
|
||||
1) NEW_GDK_SCALE=1 ;;
|
||||
1.25) NEW_GDK_SCALE=1.25 ;;
|
||||
1.6) NEW_GDK_SCALE=1.75 ;;
|
||||
2) NEW_GDK_SCALE=2 ;;
|
||||
3) NEW_GDK_SCALE=3 ;;
|
||||
4) NEW_GDK_SCALE=4 ;;
|
||||
*)
|
||||
echo "Usage: omarchy-hyprland-monitor-scaling-set <1|1.25|1.6|2|3|4>" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
MONITOR_INFO=$(hyprctl monitors -j | jq -r '.[] | select(.focused == true)')
|
||||
ACTIVE_MONITOR=$(echo "$MONITOR_INFO" | jq -r '.name')
|
||||
WIDTH=$(echo "$MONITOR_INFO" | jq -r '.width')
|
||||
HEIGHT=$(echo "$MONITOR_INFO" | jq -r '.height')
|
||||
REFRESH_RATE=$(echo "$MONITOR_INFO" | jq -r '.refreshRate')
|
||||
|
||||
hyprctl eval "hl.monitor({ output = \"$ACTIVE_MONITOR\", mode = \"${WIDTH}x${HEIGHT}@${REFRESH_RATE}\", position = \"auto\", scale = $NEW_SCALE })" >/dev/null
|
||||
|
||||
# Persist to monitors.lua if the user still has Omarchy's generic catch-all
|
||||
# defaults, so the scale survives reboots.
|
||||
MONITOR_LUA="$HOME/.config/hypr/monitors.lua"
|
||||
if [[ -f $MONITOR_LUA ]] && grep -q '^local omarchy_monitor_scale = ' "$MONITOR_LUA"; then
|
||||
sed -i -E \
|
||||
-e "s|^local omarchy_monitor_scale = .*|local omarchy_monitor_scale = ${NEW_SCALE}|" \
|
||||
-e "s|^local omarchy_gdk_scale = .*|local omarchy_gdk_scale = ${NEW_GDK_SCALE}|" \
|
||||
"$MONITOR_LUA"
|
||||
elif [[ -f $MONITOR_LUA ]] && grep -Eq '^hl\.monitor\(\{ output = "", mode = "preferred", position = "auto", scale = ("auto"|[0-9.]+) \}\)' "$MONITOR_LUA"; then
|
||||
sed -i -E \
|
||||
-e "s|^(hl\.monitor\(\{ output = \"\", mode = \"preferred\", position = \"auto\", scale = )([^ ]+)( \}\))|\\1${NEW_SCALE}\\3|" \
|
||||
-e 's|^hl\.env\("GDK_SCALE", ".*"\)|hl.env("GDK_SCALE", "'"$NEW_GDK_SCALE"'")|' \
|
||||
"$MONITOR_LUA"
|
||||
fi
|
||||
|
||||
notify-send -u low " Display scaling set to ${NEW_SCALE}x"
|
||||
@@ -1,8 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# omarchy:summary=Launch the Omarchy bar customizer
|
||||
# omarchy:group=launch
|
||||
# omarchy:name=bar-settings
|
||||
# omarchy:examples=omarchy launch bar-settings
|
||||
|
||||
exec omarchy-shell-ipc shell summon omarchy.bar-settings "{}"
|
||||
Executable
+23
@@ -0,0 +1,23 @@
|
||||
#!/bin/bash
|
||||
|
||||
# omarchy:summary=Launch the Omarchy settings panel
|
||||
# omarchy:group=launch
|
||||
# omarchy:name=settings
|
||||
# omarchy:args=[bar|plugins|defaults|style]
|
||||
# omarchy:examples=omarchy launch settings | omarchy launch settings defaults | omarchy launch settings style
|
||||
|
||||
category="${1:-}"
|
||||
payload="{}"
|
||||
case "$category" in
|
||||
bar|plugins|defaults|style)
|
||||
payload=$(printf '{"category":"%s"}' "$category")
|
||||
;;
|
||||
"")
|
||||
;;
|
||||
*)
|
||||
echo "Usage: omarchy-launch-settings [bar|plugins|defaults|style]" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
exec omarchy-shell-ipc shell summon omarchy.settings "$payload"
|
||||
@@ -11,7 +11,7 @@ Starts omarchy-shell if not running, then forwards a quickshell ipc call.
|
||||
|
||||
Examples:
|
||||
omarchy-shell-ipc shell ping
|
||||
omarchy-shell-ipc shell summon omarchy.bar-settings "{}"
|
||||
omarchy-shell-ipc shell summon omarchy.settings "{}"
|
||||
omarchy-shell-ipc shell hide omarchy.image-picker
|
||||
omarchy-shell-ipc shell listPlugins
|
||||
omarchy-shell-ipc shell listShellConfig
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
# omarchy:summary=Set Hyprland, Hyprlock, Mako, and Walker corners to sharp or round
|
||||
# omarchy:summary=Set Hyprland, Hyprlock, Mako, Walker, and Quickshell corners to sharp or round
|
||||
# omarchy:args=<sharp|round>
|
||||
# omarchy:examples=omarchy style corners round | omarchy style corners sharp
|
||||
|
||||
@@ -13,6 +13,7 @@ omarchy-style-corners-hyprland "$1"
|
||||
omarchy-style-corners-hyprlock "$1"
|
||||
omarchy-style-corners-mako "$1"
|
||||
omarchy-style-corners-walker "$1"
|
||||
omarchy-style-corners-quickshell "$1"
|
||||
|
||||
case $1 in
|
||||
sharp) omarchy-notification-send "Sharp corners enabled" -g ;;
|
||||
|
||||
Executable
+36
@@ -0,0 +1,36 @@
|
||||
#!/bin/bash
|
||||
|
||||
# omarchy:summary=Set or toggle corner radius for the omarchy-shell menu and settings panel
|
||||
# omarchy:args=[toggle|sharp|round]
|
||||
# omarchy:examples=omarchy style corners quickshell toggle | omarchy style corners quickshell round | omarchy style corners quickshell sharp
|
||||
|
||||
STYLE_FILE="$HOME/.local/state/omarchy/toggles/quickshell-menu.json"
|
||||
|
||||
current_radius() {
|
||||
[[ -f $STYLE_FILE ]] || { echo 0; return; }
|
||||
local r
|
||||
r=$(grep -oE '"radius"[[:space:]]*:[[:space:]]*[0-9]+' "$STYLE_FILE" | grep -oE '[0-9]+$')
|
||||
echo "${r:-0}"
|
||||
}
|
||||
|
||||
set_radius() {
|
||||
local radius="$1"
|
||||
mkdir -p "$(dirname "$STYLE_FILE")"
|
||||
printf '{ "radius": %s }\n' "$radius" >"$STYLE_FILE"
|
||||
}
|
||||
|
||||
case "${1:-toggle}" in
|
||||
round) set_radius 6 ;;
|
||||
sharp) set_radius 0 ;;
|
||||
toggle)
|
||||
if (( $(current_radius) > 0 )); then
|
||||
set_radius 0
|
||||
else
|
||||
set_radius 6
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
echo "Usage: omarchy-style-corners-quickshell [toggle|sharp|round]"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
@@ -10,15 +10,7 @@ set_radius() {
|
||||
local radius="$1"
|
||||
|
||||
mkdir -p "$(dirname "$TOGGLES_CSS")"
|
||||
touch "$TOGGLES_CSS"
|
||||
|
||||
if grep -q '^ border-radius:' "$TOGGLES_CSS"; then
|
||||
sed -i "s/^ border-radius:.*/ border-radius: ${radius}px;/" "$TOGGLES_CSS"
|
||||
elif grep -q '^border-radius:' "$TOGGLES_CSS"; then
|
||||
sed -i "s/^border-radius:.*/border-radius: ${radius}px;/" "$TOGGLES_CSS"
|
||||
else
|
||||
echo ".box-wrapper { border-radius: ${radius}px; }" >>"$TOGGLES_CSS"
|
||||
fi
|
||||
printf '.box-wrapper { border-radius: %spx; }\n' "$radius" >"$TOGGLES_CSS"
|
||||
}
|
||||
|
||||
case "${1:-toggle}" in
|
||||
|
||||
Executable
+26
@@ -0,0 +1,26 @@
|
||||
#!/bin/bash
|
||||
|
||||
# omarchy:summary=List themes with preview image paths (tab-separated: name\tslug\tpreview)
|
||||
# omarchy:hidden=true
|
||||
|
||||
OMARCHY_PATH=${OMARCHY_PATH:-$HOME/.local/share/omarchy}
|
||||
|
||||
omarchy-theme-list 2>/dev/null | while IFS= read -r name; do
|
||||
[[ -n $name ]] || continue
|
||||
slug=$(printf '%s' "$name" | tr '[:upper:]' '[:lower:]' | tr ' ' '-')
|
||||
preview=""
|
||||
for base in "$HOME/.config/omarchy/themes" "$OMARCHY_PATH/themes"; do
|
||||
[[ -d $base/$slug ]] || continue
|
||||
for ext in png jpg jpeg webp; do
|
||||
if [[ -f $base/$slug/preview.$ext ]]; then
|
||||
preview="$base/$slug/preview.$ext"
|
||||
break 2
|
||||
fi
|
||||
done
|
||||
if [[ -z $preview && -d $base/$slug/backgrounds ]]; then
|
||||
preview=$(find -L "$base/$slug/backgrounds" -maxdepth 1 -type f \( -iname '*.jpg' -o -iname '*.jpeg' -o -iname '*.png' -o -iname '*.webp' \) 2>/dev/null | sort | head -n1)
|
||||
[[ -n $preview ]] && break
|
||||
fi
|
||||
done
|
||||
printf '%s\t%s\t%s\n' "$name" "$slug" "$preview"
|
||||
done
|
||||
+43
-10
@@ -1,15 +1,48 @@
|
||||
#!/bin/bash
|
||||
|
||||
# omarchy:summary=Toggle bar visibility
|
||||
# omarchy:examples=omarchy toggle bar
|
||||
# omarchy:summary=Toggle bar visibility without killing the Omarchy shell
|
||||
# omarchy:args=[toggle|show|hide]
|
||||
# omarchy:examples=omarchy toggle bar | omarchy toggle bar hide | omarchy toggle bar show
|
||||
|
||||
OMARCHY_PATH=${OMARCHY_PATH:-$HOME/.local/share/omarchy}
|
||||
CONFIG_DIR="$OMARCHY_PATH/default/quickshell/omarchy-shell"
|
||||
FLAG="$HOME/.local/state/omarchy/toggles/bar-off"
|
||||
|
||||
omarchy-toggle bar-off
|
||||
apply_state() {
|
||||
case "$1" in
|
||||
hidden)
|
||||
mkdir -p "$(dirname "$FLAG")"
|
||||
touch "$FLAG"
|
||||
;;
|
||||
visible)
|
||||
rm -f "$FLAG"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
if quickshell list -p "$CONFIG_DIR" 2>/dev/null | grep -q '^Instance '; then
|
||||
quickshell kill -p "$CONFIG_DIR" >/dev/null 2>&1 || true
|
||||
else
|
||||
uwsm-app -- env OMARCHY_PATH="$OMARCHY_PATH" quickshell -p "$CONFIG_DIR" >/dev/null 2>&1 &
|
||||
fi
|
||||
case "${1:-toggle}" in
|
||||
hide|off)
|
||||
apply_state hidden
|
||||
state=hidden
|
||||
;;
|
||||
show|on)
|
||||
apply_state visible
|
||||
state=visible
|
||||
;;
|
||||
toggle|"")
|
||||
if [[ -f $FLAG ]]; then
|
||||
apply_state visible
|
||||
state=visible
|
||||
else
|
||||
apply_state hidden
|
||||
state=hidden
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
echo "Usage: omarchy-toggle-bar [toggle|show|hide]" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
case "$state" in
|
||||
visible) omarchy-notification-send "Bar shown" -g ;;
|
||||
hidden) omarchy-notification-send "Bar hidden" -g ;;
|
||||
esac
|
||||
|
||||
Reference in New Issue
Block a user