Pick window transparency from Appearance > Window Transparency, and a Glassy bar background (#14991)
* Pick window transparency from Appearance > Window Transparency Transparent, the default, keeps today's windows. Opaque turns the windows Omarchy makes transparent solid. Glassy is the frosted glass Starship (#14726): its blur behind every see-through window and shell surface, and a see-through, blurred background in the theme's terminal files, since foot turns compositor blur down and a Hyprland opacity rule fades text. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Leave window transparency to Appearance when animations are off Turning animations off no longer makes windows opaque. VM installs start with opaque windows instead, and a migration keeps them opaque for anyone who already has animations off. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Add a Glassy bar background, under Menu Bar > Bar Background Menu Bar > Bar Background picks Opaque Bar, Glassy Bar or Clear Bar, and Indicators becomes Bar Indicators to match. Glassy keeps the theme background faintly and Hyprland blurs what is behind it, with the same blur as Glassy windows. omarchy bar background opaque|glassy|none|cycle sets it and prints it when given nothing. omarchy bar transparent true|false|toggle stays for compatibility, as none and opaque. Double-clicking the bar cycles through the three backgrounds the same way, from clear to glassy to opaque. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Stop when a saved corner choice can't be removed Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Make btop follow glassy windows --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
be7c7bf378
commit
a98e55eb91
32 files changed
+814
-64
No files matched your search
@@ -59,7 +59,7 @@ const bar = requireFromRoot('shell/plugins/bar/BarModel.js')
|
||||
const barSource = fs.readFileSync(root + '/shell/plugins/bar/Bar.qml', 'utf8')
|
||||
const shellSource = fs.readFileSync(root + '/shell/shell.qml', 'utf8')
|
||||
|
||||
assert(/function toggleBarTransparency\(\): string \{[\s\S]*?shell\.bar\.toggleTransparency\(\)/.test(shellSource), 'shell exposes the bar transparency toggle over IPC')
|
||||
assert(/function toggleBarTransparency\(\): string \{[\s\S]*?shell\.bar\.cycleBackground\(\)/.test(shellSource), 'shell exposes the bar background cycle over IPC')
|
||||
|
||||
// put tolerates a placement target the bar does not carry, so the IPC call
|
||||
// must reach the registry's put rather than route back through enable.
|
||||
|
||||
@@ -255,6 +255,9 @@ pass "Hyprland bootstrap reloads cached Omarchy config modules"
|
||||
|
||||
TMPDIR=$(mktemp -d)
|
||||
mkdir -p "$TMPDIR/home/.config/omarchy"
|
||||
# The bar keeps its blur toggle where Hyprland reads it, under XDG_STATE_HOME,
|
||||
# so that points into the test home too.
|
||||
export XDG_STATE_HOME="$TMPDIR/home/.local/state"
|
||||
|
||||
ipc_mock_bin="$TMPDIR/ipc-mock"
|
||||
mkdir -p "$ipc_mock_bin"
|
||||
@@ -335,16 +338,97 @@ pass "shell config sets bar position"
|
||||
|
||||
HOME="$TMPDIR/home" OMARCHY_PATH="$ROOT" omarchy-bar transparent true
|
||||
jq -e '
|
||||
.bar.transparent == true and
|
||||
.bar.background == "none" and
|
||||
.bar.position == "bottom" and
|
||||
.plugins == []
|
||||
' "$TMPDIR/home/.config/omarchy/shell.json" >/dev/null
|
||||
pass "shell config sets bar transparency"
|
||||
|
||||
HOME="$TMPDIR/home" OMARCHY_PATH="$ROOT" omarchy-bar transparent toggle
|
||||
jq -e '.bar.transparent == false' "$TMPDIR/home/.config/omarchy/shell.json" >/dev/null
|
||||
jq -e '.bar.background == "opaque"' "$TMPDIR/home/.config/omarchy/shell.json" >/dev/null
|
||||
pass "shell config toggles bar transparency"
|
||||
|
||||
# The bar background is opaque, glassy or none. A glassy bar needs Hyprland's
|
||||
# blur, so the bar-glassy toggle follows it.
|
||||
printf '#!/bin/bash\nprintf "%%s\\n" "$*" >>"%s/hyprctl.log"\n' "$TMPDIR" >"$ipc_mock_bin/hyprctl"
|
||||
chmod +x "$ipc_mock_bin/hyprctl"
|
||||
glass_toggle="$TMPDIR/home/.local/state/omarchy/toggles/hypr/bar-glassy.lua"
|
||||
bar_background() { HOME="$TMPDIR/home" OMARCHY_PATH="$ROOT" omarchy-bar background "$@"; }
|
||||
|
||||
bar_background opaque >/dev/null
|
||||
[[ $(bar_background) == "opaque" ]] || fail "an opaque bar background is reported"
|
||||
bar_background glassy >/dev/null
|
||||
jq -e '.bar.background == "glassy"' "$TMPDIR/home/.config/omarchy/shell.json" >/dev/null ||
|
||||
fail "shell config sets a glassy bar"
|
||||
[[ $(bar_background) == "glassy" ]] || fail "a glassy bar background is reported"
|
||||
[[ -f $glass_toggle ]] || fail "a glassy bar turns on Hyprland's blur behind it"
|
||||
grep -qx 'reload' "$TMPDIR/hyprctl.log" || fail "a glassy bar reloads Hyprland"
|
||||
bar_background none >/dev/null
|
||||
jq -e '.bar.background == "none"' "$TMPDIR/home/.config/omarchy/shell.json" >/dev/null ||
|
||||
fail "a bar without a background is stored as none"
|
||||
[[ ! -f $glass_toggle ]] || fail "a bar without a background turns Hyprland's blur off again"
|
||||
pass "shell config sets the bar background, and Hyprland's blur follows a glassy one"
|
||||
|
||||
seen=()
|
||||
for _ in 1 2 3; do
|
||||
bar_background cycle >/dev/null
|
||||
seen+=("$(bar_background)")
|
||||
done
|
||||
[[ ${seen[*]} == "glassy opaque none" ]] || fail "the bar background cycles from clear to glassy to opaque and around" "${seen[*]}"
|
||||
if bar_background frosted 2>/dev/null; then
|
||||
fail "an unknown bar background is refused"
|
||||
fi
|
||||
: >"$TMPDIR/hyprctl.log"
|
||||
bar_background opaque >/dev/null
|
||||
[[ ! -s $TMPDIR/hyprctl.log ]] || fail "Hyprland reloads only when the bar's glass changes"
|
||||
pass "the bar background cycles through its looks and refuses unknown ones"
|
||||
|
||||
# transparent stays for scripts written against it: true is none, false opaque.
|
||||
bar_background glassy >/dev/null
|
||||
HOME="$TMPDIR/home" OMARCHY_PATH="$ROOT" omarchy-bar transparent true >/dev/null
|
||||
[[ $(bar_background) == "none" ]] || fail "transparent true leaves the bar without a background"
|
||||
HOME="$TMPDIR/home" OMARCHY_PATH="$ROOT" omarchy-bar transparent toggle >/dev/null
|
||||
[[ $(bar_background) == "opaque" ]] || fail "toggling transparency off makes the bar opaque"
|
||||
# A shell.json from before background says transparent, which reads as none
|
||||
# and is dropped once a background is set.
|
||||
jq '.bar.transparent = true | del(.bar.background)' "$TMPDIR/home/.config/omarchy/shell.json" >"$TMPDIR/legacy.json" &&
|
||||
mv "$TMPDIR/legacy.json" "$TMPDIR/home/.config/omarchy/shell.json"
|
||||
[[ $(bar_background) == "none" ]] || fail "an older transparent bar reads as no background"
|
||||
bar_background glassy >/dev/null
|
||||
jq -e '.bar.background == "glassy" and (.bar | has("transparent") | not)' "$TMPDIR/home/.config/omarchy/shell.json" >/dev/null ||
|
||||
fail "setting a background drops the older transparent flag"
|
||||
pass "the older transparent form still sets and reads as the bar background"
|
||||
|
||||
# Restoring the default bar also restores its opaque background, and the blur
|
||||
# behind a glassy one goes with it.
|
||||
bar_background glassy >/dev/null
|
||||
[[ -f $glass_toggle ]] || fail "a glassy bar has its blur on before defaults"
|
||||
HOME="$TMPDIR/home" OMARCHY_PATH="$ROOT" omarchy-bar defaults >/dev/null
|
||||
[[ $(bar_background) == "opaque" && ! -f $glass_toggle ]] || fail "omarchy bar defaults turns a glassy bar's blur off"
|
||||
pass "restoring the default bar turns a glassy bar's blur off"
|
||||
|
||||
# A background set by editing shell.json gets its blur when the shell syncs it.
|
||||
jq '.bar.background = "glassy"' "$TMPDIR/home/.config/omarchy/shell.json" >"$TMPDIR/edited.json" &&
|
||||
mv "$TMPDIR/edited.json" "$TMPDIR/home/.config/omarchy/shell.json"
|
||||
HOME="$TMPDIR/home" OMARCHY_PATH="$ROOT" omarchy-bar sync-glass
|
||||
[[ -f $glass_toggle ]] || fail "syncing a hand-edited glassy bar turns its blur on"
|
||||
jq '.bar.background = "opaque"' "$TMPDIR/home/.config/omarchy/shell.json" >"$TMPDIR/edited.json" &&
|
||||
mv "$TMPDIR/edited.json" "$TMPDIR/home/.config/omarchy/shell.json"
|
||||
HOME="$TMPDIR/home" OMARCHY_PATH="$ROOT" omarchy-bar sync-glass
|
||||
[[ ! -f $glass_toggle ]] || fail "syncing a hand-edited opaque bar turns its blur off"
|
||||
pass "a bar background edited into shell.json gets its blur synced"
|
||||
|
||||
# A glassy bar whose blur can't be turned on keeps the background it had.
|
||||
toggles_dir="${glass_toggle%/*}"
|
||||
chmod a-w "$toggles_dir"
|
||||
if bar_background glassy >/dev/null 2>&1; then
|
||||
chmod u+w "$toggles_dir"
|
||||
fail "a bar whose blur can't be turned on reports failure"
|
||||
fi
|
||||
chmod u+w "$toggles_dir"
|
||||
[[ $(bar_background) == "opaque" && ! -f $glass_toggle ]] || fail "a bar whose blur can't be turned on keeps its old background" "$(bar_background)"
|
||||
pass "a bar whose blur can't change keeps its old background"
|
||||
|
||||
HOME="$TMPDIR/home" OMARCHY_PATH="$ROOT" omarchy-bar set omarchy.bluetooth enabled false --json
|
||||
grep -Fqx 'shell setBarWidget omarchy.bluetooth enabled false {}' \
|
||||
"$TMPDIR/home/.local/state/omarchy/shell-ipc-calls"
|
||||
|
||||
+230
@@ -0,0 +1,230 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
source "$(dirname "${BASH_SOURCE[0]}")/base-test.sh"
|
||||
|
||||
tmpdir=$(mktemp -d)
|
||||
trap 'rm -rf "$tmpdir"' EXIT
|
||||
|
||||
stub_dir="$tmpdir/bin"
|
||||
home_dir="$tmpdir/home"
|
||||
state_home="$tmpdir/state"
|
||||
toggles_dir="$state_home/omarchy/toggles/hypr"
|
||||
mkdir -p "$stub_dir" "$home_dir"
|
||||
|
||||
for command in hyprctl omarchy-notification-send omarchy-restart-terminal omarchy-theme-set-foot omarchy-restart-btop; do
|
||||
printf '#!/bin/bash\nprintf "%%s\\n" "%s $*" >>"%s/commands.log"\n' "$command" "$tmpdir" >"$stub_dir/$command"
|
||||
done
|
||||
chmod +x "$stub_dir"/*
|
||||
|
||||
run() {
|
||||
HOME="$home_dir" XDG_RUNTIME_DIR="$tmpdir" XDG_STATE_HOME="$state_home" XDG_CONFIG_HOME="$home_dir/.config" OMARCHY_PATH="$ROOT" PATH="$stub_dir:$ROOT/bin:$PATH" "$@"
|
||||
}
|
||||
|
||||
[[ $(run omarchy-hyprland-window-transparency) == "transparent" ]] || fail "windows start out transparent"
|
||||
pass "windows start out transparent"
|
||||
|
||||
run omarchy-hyprland-window-transparency glassy
|
||||
[[ $(run omarchy-hyprland-window-transparency) == "glassy" ]] || fail "glassy windows are reported"
|
||||
cmp -s "$ROOT/default/hypr/toggles/window-glassy.lua" "$toggles_dir/window-glassy.lua" || fail "glassy windows are loaded after the theme"
|
||||
grep -qx 'hyprctl reload' "$tmpdir/commands.log" || fail "new transparency reloads Hyprland"
|
||||
grep -q '^omarchy-restart-btop ' "$tmpdir/commands.log" || fail "new transparency reloads running btop windows"
|
||||
pass "glassy windows override the theme"
|
||||
|
||||
run omarchy-hyprland-window-transparency opaque
|
||||
[[ $(run omarchy-hyprland-window-transparency) == "opaque" ]] || fail "opaque windows are reported"
|
||||
[[ ! -e $toggles_dir/window-glassy.lua ]] || fail "opaque windows replace glassy ones"
|
||||
pass "opaque windows replace glassy ones"
|
||||
|
||||
run omarchy-hyprland-window-transparency transparent
|
||||
[[ $(run omarchy-hyprland-window-transparency) == "transparent" ]] || fail "transparent windows are reported"
|
||||
[[ ! -e $toggles_dir/window-opaque.lua ]] || fail "transparent windows drop the override"
|
||||
pass "transparent windows drop the override"
|
||||
|
||||
if run omarchy-hyprland-window-transparency frosted 2>/dev/null; then
|
||||
fail "unknown transparency is refused"
|
||||
fi
|
||||
pass "unknown transparency is refused"
|
||||
|
||||
# A failed save keeps the transparency already chosen.
|
||||
run omarchy-hyprland-window-transparency glassy
|
||||
chmod a-w "$toggles_dir"
|
||||
if run omarchy-hyprland-window-transparency opaque 2>/dev/null; then
|
||||
chmod u+w "$toggles_dir"
|
||||
fail "a failed save is reported"
|
||||
fi
|
||||
chmod u+w "$toggles_dir"
|
||||
[[ $(run omarchy-hyprland-window-transparency) == "glassy" ]] || fail "a failed save keeps the transparency already chosen"
|
||||
run omarchy-hyprland-window-transparency transparent
|
||||
pass "a failed save keeps the transparency already chosen"
|
||||
|
||||
# GTK apps only ask Hyprland for blur under a CSS backdrop-filter, so glassy
|
||||
# imports one into the user's gtk.css, leaving the rest of it alone.
|
||||
gtk_css="$home_dir/.config/gtk-4.0/gtk.css"
|
||||
mkdir -p "${gtk_css%/*}"
|
||||
printf 'label { color: red; }\n' >"$gtk_css"
|
||||
run omarchy-hyprland-window-transparency glassy
|
||||
grep -qxF "@import url(\"file://$ROOT/default/gtk/glass.css\");" "$gtk_css" || fail "glassy GTK apps import the backdrop blur"
|
||||
grep -qx 'label { color: red; }' "$gtk_css" || fail "glassy keeps the user's own GTK CSS"
|
||||
run omarchy-hyprland-window-transparency glassy
|
||||
(( $(grep -c 'omarchy-glass begin' "$gtk_css") == 1 )) || fail "glassy GTK apps import the backdrop blur once"
|
||||
run omarchy-hyprland-window-transparency transparent
|
||||
[[ $(<"$gtk_css") == 'label { color: red; }' ]] || fail "leaving glassy restores the user's GTK CSS"
|
||||
grep -qF 'backdrop-filter: blur(' "$ROOT/default/gtk/glass.css" || fail "the GTK glass is a backdrop blur"
|
||||
printf 'label { color: red; }' >"$gtk_css"
|
||||
run omarchy-hyprland-window-transparency glassy
|
||||
run omarchy-hyprland-window-transparency transparent
|
||||
[[ $(od -An -c "$gtk_css" | tr -d ' \n') == 'label{color:red;}' ]] || fail "leaving glassy restores GTK CSS without a final newline"
|
||||
|
||||
# A GTK config that cannot be written fails the change rather than announcing it.
|
||||
printf 'label { color: red; }\n' >"$gtk_css"
|
||||
chmod a-w "$gtk_css"
|
||||
: >"$tmpdir/commands.log"
|
||||
if run omarchy-hyprland-window-transparency glassy 2>/dev/null; then
|
||||
chmod u+w "$gtk_css"
|
||||
fail "a GTK config that cannot be written fails the change"
|
||||
fi
|
||||
chmod u+w "$gtk_css"
|
||||
! grep -q '^omarchy-notification-send' "$tmpdir/commands.log" || fail "a failed change is not announced"
|
||||
[[ $(run omarchy-hyprland-window-transparency) == "transparent" ]] || fail "a failed change keeps the previous choice"
|
||||
run omarchy-hyprland-window-transparency transparent
|
||||
pass "glassy GTK apps get a backdrop blur, and leaving glassy takes it out"
|
||||
|
||||
# Opaque reaches the windows Omarchy makes transparent through their tag.
|
||||
grep -qF 'tag = "+transparent-window"' "$ROOT/default/hypr/helpers.lua" || fail "transparent windows carry a tag"
|
||||
grep -qF 'o.window({ tag = "transparent-window" }, { opacity = "1 1" })' "$ROOT/default/hypr/toggles/window-opaque.lua" ||
|
||||
fail "opaque windows apply to the tagged windows"
|
||||
pass "opaque windows apply to the windows Omarchy makes transparent"
|
||||
|
||||
# Terminals turn compositor blur down and fade their text with the window, so
|
||||
# glassy gives each theme terminal file a see-through, blurred background.
|
||||
theme_dir="$tmpdir/theme"
|
||||
mkdir -p "$theme_dir"
|
||||
printf '[colors.primary]\nbackground = "#000000"\n' >"$theme_dir/alacritty.toml"
|
||||
printf '[colors-dark]\nbackground=000000\n' >"$theme_dir/foot.ini"
|
||||
printf 'background #000000\n' >"$theme_dir/kitty.conf"
|
||||
printf 'background = #000000\nbackground-opacity = 0.9\n' >"$theme_dir/ghostty.conf"
|
||||
printf 'theme[main_bg]="#102030"\ntheme[main_fg]="#ffffff"\n' >"$theme_dir/btop.theme"
|
||||
cp -r "$theme_dir" "$tmpdir/theme-before"
|
||||
|
||||
run omarchy-hyprland-window-transparency glassy
|
||||
run omarchy-theme-set-glass "$theme_dir"
|
||||
run omarchy-theme-set-glass "$theme_dir"
|
||||
grep -qx 'opacity = 0.65' "$theme_dir/alacritty.toml" || fail "glassy alacritty is see-through"
|
||||
grep -qx 'alpha=0.65' "$theme_dir/foot.ini" && grep -qx 'blur=yes' "$theme_dir/foot.ini" || fail "glassy foot is see-through and asks for blur"
|
||||
grep -qx 'background_opacity 0.65' "$theme_dir/kitty.conf" || fail "glassy kitty is see-through"
|
||||
(( $(grep -c 'omarchy-glass begin' "$theme_dir/foot.ini") == 1 )) || fail "glassy terminals get the glass once"
|
||||
[[ $(grep '^theme\[main_bg\]=' "$theme_dir/btop.theme" | tail -1) == 'theme[main_bg]=""' ]] || fail "glassy btop uses the terminal background"
|
||||
(( $(grep -c 'omarchy-glass begin' "$theme_dir/btop.theme") == 1 )) || fail "glassy btop gets the glass once"
|
||||
pass "btop follows the glassy terminal background"
|
||||
(( $(grep -c 'background-opacity' "$theme_dir/ghostty.conf") == 1 )) &&
|
||||
grep -qx 'background-opacity = 0.9' "$theme_dir/ghostty.conf" || fail "a theme's own terminal opacity is kept"
|
||||
grep -qx "gtk-custom-css = $ROOT/default/gtk/glass.css" "$theme_dir/ghostty.conf" ||
|
||||
fail "a ghostty theme with its own opacity still gets the backdrop blur"
|
||||
# A foot theme with its own alpha keeps it but still asks for blur, as
|
||||
# Hyprland skips blur for foot unless it does.
|
||||
own_alpha_dir="$tmpdir/own-alpha-theme"
|
||||
mkdir -p "$own_alpha_dir"
|
||||
printf '[colors-dark]\nbackground=000000\nalpha=0.8\n' >"$own_alpha_dir/foot.ini"
|
||||
run omarchy-theme-set-glass "$own_alpha_dir"
|
||||
(( $(grep -c '^alpha=' "$own_alpha_dir/foot.ini") == 1 )) && grep -qx 'alpha=0.8' "$own_alpha_dir/foot.ini" &&
|
||||
grep -qx 'blur=yes' "$own_alpha_dir/foot.ini" || fail "a foot theme with its own alpha still asks for blur"
|
||||
if command -v foot >/dev/null; then
|
||||
foot --check-config -c "$own_alpha_dir/foot.ini" || fail "a foot theme with its own alpha stays valid"
|
||||
fi
|
||||
pass "a theme's own terminal opacity is kept, and its blur is still added"
|
||||
if command -v foot >/dev/null; then
|
||||
foot --check-config -c "$theme_dir/foot.ini" || fail "glassy foot config is valid"
|
||||
fi
|
||||
# A window table of the theme's own takes the glass in, as TOML refuses a
|
||||
# table declared twice.
|
||||
window_dir="$tmpdir/window-theme"
|
||||
mkdir -p "$window_dir"
|
||||
printf '[window] # mine\npadding = { x = 4, y = 4 }\nblur = false\n\n[colors.primary]\nbackground = "#000000"\n' >"$window_dir/alacritty.toml"
|
||||
cp "$window_dir/alacritty.toml" "$tmpdir/window-before.toml"
|
||||
run omarchy-theme-set-glass "$window_dir"
|
||||
run omarchy-theme-set-glass "$window_dir"
|
||||
(( $(grep -c '^\[window\]' "$window_dir/alacritty.toml") == 1 )) || fail "glassy alacritty keeps a single window table"
|
||||
if command -v python3 >/dev/null; then
|
||||
python3 -c 'import sys, tomllib; c = tomllib.load(open(sys.argv[1], "rb")); assert c["window"]["opacity"] == 0.65 and c["window"]["padding"]["x"] == 4' "$window_dir/alacritty.toml" ||
|
||||
fail "glassy alacritty with a window table of its own stays valid TOML"
|
||||
fi
|
||||
HOME="$home_dir" XDG_STATE_HOME="$tmpdir/no-glass" OMARCHY_PATH="$ROOT" PATH="$stub_dir:$ROOT/bin:$PATH" omarchy-theme-set-glass "$window_dir"
|
||||
cmp -s "$tmpdir/window-before.toml" "$window_dir/alacritty.toml" || fail "leaving glassy restores an alacritty window table"
|
||||
pass "glassy alacritty joins a window table the theme already has"
|
||||
|
||||
# A file without a final newline gets one with the glass, and loses it again
|
||||
# when the glass comes out, so leaving glassy restores it byte for byte.
|
||||
bare_dir="$tmpdir/bare-theme"
|
||||
mkdir -p "$bare_dir"
|
||||
printf 'background #000000' >"$bare_dir/kitty.conf"
|
||||
cp "$bare_dir/kitty.conf" "$tmpdir/bare-before.conf"
|
||||
run omarchy-theme-set-glass "$bare_dir"
|
||||
grep -qx 'background_opacity 0.65' "$bare_dir/kitty.conf" || fail "glassy reaches a file without a final newline"
|
||||
grep -qx 'background #000000' "$bare_dir/kitty.conf" || fail "glassy ends the line before its block"
|
||||
HOME="$home_dir" XDG_STATE_HOME="$tmpdir/no-glass" OMARCHY_PATH="$ROOT" PATH="$stub_dir:$ROOT/bin:$PATH" omarchy-theme-set-glass "$bare_dir"
|
||||
cmp -s "$tmpdir/bare-before.conf" "$bare_dir/kitty.conf" || fail "leaving glassy restores a file without a final newline"
|
||||
pass "leaving glassy restores a file without a final newline byte for byte"
|
||||
|
||||
btop_dir="$tmpdir/transparent-btop-theme"
|
||||
mkdir -p "$btop_dir"
|
||||
printf 'theme[main_bg]=""\n' >"$btop_dir/btop.theme"
|
||||
cp "$btop_dir/btop.theme" "$tmpdir/btop-before.theme"
|
||||
run omarchy-theme-set-glass "$btop_dir"
|
||||
cmp -s "$tmpdir/btop-before.theme" "$btop_dir/btop.theme" || fail "btop themes already using the terminal background are kept"
|
||||
pass "btop themes already using the terminal background are kept"
|
||||
|
||||
ghostty_dir="$tmpdir/ghostty-theme"
|
||||
mkdir -p "$ghostty_dir"
|
||||
printf 'background = #000000\n' >"$ghostty_dir/ghostty.conf"
|
||||
run omarchy-theme-set-glass "$ghostty_dir"
|
||||
grep -qx 'background-opacity = 0.65' "$ghostty_dir/ghostty.conf" &&
|
||||
grep -qx "gtk-custom-css = $ROOT/default/gtk/glass.css" "$ghostty_dir/ghostty.conf" ||
|
||||
fail "glassy ghostty is see-through and loads the GTK backdrop blur"
|
||||
pass "glassy terminals get a see-through, blurred background"
|
||||
|
||||
run omarchy-hyprland-window-transparency transparent
|
||||
run omarchy-theme-set-glass "$theme_dir"
|
||||
diff -r "$tmpdir/theme-before" "$theme_dir" || fail "leaving glassy restores the terminal files"
|
||||
pass "leaving glassy restores the terminal files"
|
||||
|
||||
# Running foot terminals take the theme's background alpha over OSC, so a
|
||||
# change of transparency reaches them without a restart. script stands in for
|
||||
# foot: its child sits on a real pty, and whatever reaches the pty lands in the
|
||||
# typescript.
|
||||
if command -v script >/dev/null; then
|
||||
foot_home="$tmpdir/foot-home"
|
||||
foot_theme="$foot_home/.local/state/omarchy/current/theme"
|
||||
mkdir -p "$foot_theme" "$tmpdir/foot-bin"
|
||||
printf 'background = "#102030"\nforeground = "#ffffff"\n' >"$foot_theme/colors.toml"
|
||||
printf '[colors-dark]\nbackground=102030\n' >"$foot_theme/foot.ini"
|
||||
|
||||
script -qfc "sleep 30" "$tmpdir/typescript" >/dev/null 2>&1 &
|
||||
script_pid=$!
|
||||
for _ in {1..50}; do pgrep -P "$script_pid" >/dev/null && break; sleep 0.1; done
|
||||
|
||||
# Only the foot lookup is faked; finding its shell goes to the real pgrep.
|
||||
real_pgrep=$(command -v pgrep)
|
||||
printf '#!/bin/bash\nif [[ $1 == "-x" && $2 == "foot" ]]; then echo %s; else exec %s "$@"; fi\n' "$script_pid" "$real_pgrep" >"$tmpdir/foot-bin/pgrep"
|
||||
chmod +x "$tmpdir/foot-bin/pgrep"
|
||||
|
||||
set_foot() {
|
||||
HOME="$foot_home" PATH="$tmpdir/foot-bin:$ROOT/bin:$PATH" omarchy-theme-set-foot
|
||||
sleep 0.3
|
||||
}
|
||||
|
||||
set_foot
|
||||
grep -qF $'\e]11;[100]#102030' "$tmpdir/typescript" || fail "running foot terminals stay opaque without glass"
|
||||
printf '# omarchy-glass begin\n[colors-dark]\nalpha=0.65\nblur=yes\n# omarchy-glass end\n' >>"$foot_theme/foot.ini"
|
||||
set_foot
|
||||
grep -qF $'\e]11;[65]#102030' "$tmpdir/typescript" || fail "running foot terminals turn glassy"
|
||||
kill "$script_pid" 2>/dev/null || true
|
||||
pass "running foot terminals take the theme's background alpha"
|
||||
else
|
||||
skip "script is not installed"
|
||||
fi
|
||||
|
||||
grep -qx 'blur=yes' "$ROOT/default/themed/foot.ini.tpl" || fail "foot starts ready to blur"
|
||||
grep -qx 'dynamic_background_opacity yes' "$ROOT/default/themed/kitty.conf.tpl" || fail "kitty starts ready to change opacity"
|
||||
pass "foot and kitty start ready for glass, since they read that only at launch"
|
||||
@@ -365,7 +365,7 @@ assert(
|
||||
)
|
||||
assertDeepEqual(
|
||||
defaultItems.filter(item => item.parent === 'trigger.appearance.top-bar').map(item => item.label),
|
||||
['Hide Bar', 'Show Bar', 'Position Bar', 'Transparent Bar', 'Opaque Bar', 'Indicators'],
|
||||
['Hide Bar', 'Show Bar', 'Position Bar', 'Bar Background', 'Bar Indicators'],
|
||||
'menu gathers the Menu Bar under Trigger > Appearance'
|
||||
)
|
||||
assert(
|
||||
@@ -384,16 +384,43 @@ assert(
|
||||
['top', 'bottom', 'left', 'right'].every(position => defaultById[`trigger.appearance.top-bar.position.${position}`].action === `omarchy-bar position ${position}`),
|
||||
'menu lists all Menu Bar positions under Position'
|
||||
)
|
||||
assert(
|
||||
defaultById['trigger.appearance.top-bar.transparent'].action === 'omarchy-bar transparent true'
|
||||
&& defaultById['trigger.appearance.top-bar.opaque'].action === 'omarchy-bar transparent false'
|
||||
&& defaultById['trigger.appearance.top-bar.transparent'].when === '! ' + defaultById['trigger.appearance.top-bar.opaque'].when,
|
||||
'menu offers Transparent Bar while the bar is opaque and Opaque Bar while it is transparent'
|
||||
assertDeepEqual(
|
||||
defaultItems.filter(item => item.parent === 'trigger.appearance.top-bar.background').map(item => [item.label, item.action]),
|
||||
[
|
||||
['Opaque Bar', 'omarchy-bar background opaque'],
|
||||
['Glassy Bar', 'omarchy-bar background glassy'],
|
||||
['Clear Bar', 'omarchy-bar background none']
|
||||
],
|
||||
'menu picks the bar background from Menu Bar > Bar Background'
|
||||
)
|
||||
// Exactly the bar's current background is checked. Ask bash, against a
|
||||
// shell.json in each state, which rows it checks.
|
||||
{
|
||||
const os = require('os')
|
||||
const { execFileSync } = require('child_process')
|
||||
const home = fs.mkdtempSync(path.join(os.tmpdir(), 'menu-bar-background-'))
|
||||
fs.mkdirSync(path.join(home, '.config/omarchy'), { recursive: true })
|
||||
const checked = bar => {
|
||||
fs.writeFileSync(path.join(home, '.config/omarchy/shell.json'), JSON.stringify({ bar }))
|
||||
return ['opaque', 'glassy', 'clear'].filter(look => {
|
||||
try {
|
||||
execFileSync('bash', ['-c', defaultById[`trigger.appearance.top-bar.background.${look}`].checked], { env: { ...process.env, HOME: home, OMARCHY_PATH: root, PATH: `${root}/bin:${process.env.PATH}` } })
|
||||
return true
|
||||
} catch (e) {
|
||||
return false
|
||||
}
|
||||
})
|
||||
}
|
||||
assertDeepEqual(checked({}), ['opaque'], 'menu checks Opaque Bar while the bar is opaque')
|
||||
assertDeepEqual(checked({ background: 'glassy' }), ['glassy'], 'menu checks Glassy Bar while the bar is glassy')
|
||||
assertDeepEqual(checked({ background: 'none' }), ['clear'], 'menu checks Clear Bar while the bar has no background')
|
||||
assertDeepEqual(checked({ transparent: true }), ['clear'], 'menu checks Clear Bar for a bar made transparent before backgrounds')
|
||||
fs.rmSync(home, { recursive: true, force: true })
|
||||
}
|
||||
assertDeepEqual(
|
||||
defaultItems.filter(item => item.parent === 'trigger.appearance.top-bar.indicators').map(item => item.label),
|
||||
['Battery Percentage', 'Clock'],
|
||||
'menu gathers bar indicator options under Menu Bar > Indicators'
|
||||
'menu gathers bar indicator options under Menu Bar > Bar Indicators'
|
||||
)
|
||||
const clockModel = requireFromRoot('shell/plugins/panels/clock/Model.js')
|
||||
const clockRows = defaultItems.filter(item => item.parent === 'trigger.appearance.top-bar.indicators.clock')
|
||||
@@ -417,8 +444,17 @@ assertDeepEqual(
|
||||
[['Theme Corners', 'omarchy-hyprland-corners theme'], ['Sharp Corners', 'omarchy-hyprland-corners sharp'], ['Rounded Corners', 'omarchy-hyprland-corners rounded']],
|
||||
'menu picks window corners from Appearance > Window Corners'
|
||||
)
|
||||
assertDeepEqual(
|
||||
defaultItems.filter(item => item.parent === 'trigger.appearance.window-transparency').map(item => [item.label, item.action]),
|
||||
[
|
||||
['Opaque Windows', 'omarchy-hyprland-window-transparency opaque'],
|
||||
['Transparent Windows', 'omarchy-hyprland-window-transparency transparent'],
|
||||
['Glassy Windows', 'omarchy-hyprland-window-transparency glassy']
|
||||
],
|
||||
'menu picks window transparency from Appearance > Window Transparency'
|
||||
)
|
||||
const triggerIds = triggerItems.map(item => item.id)
|
||||
const appearanceLabels = ['Animations', 'Menu Bar', 'Window Gaps', 'Window Corners', '1-Window Ratio', 'Workspace Layout', 'Herdr Theme Sync']
|
||||
const appearanceLabels = ['Animations', 'Menu Bar', 'Window Gaps', 'Window Corners', 'Window Transparency', '1-Window Ratio', 'Workspace Layout', 'Herdr Theme Sync']
|
||||
assertEqual(triggerIds.indexOf('trigger.toggle'), triggerIds.indexOf('trigger.appearance') + 1, 'menu places Toggle right after Appearance')
|
||||
assertDeepEqual(
|
||||
defaultItems.filter(item => item.parent === 'trigger.appearance').map(item => item.label),
|
||||
|
||||
@@ -41,7 +41,7 @@ printf 'no newline {{ accent }}' >"$themed/tail.txt.tpl"
|
||||
# Function arguments may be separated by any whitespace, tabs included.
|
||||
printf '{{ mix\tbackground accent 30%% }} {{\tmix_rgb red\tblue 50%%\t}} {{ gradient_start\thyprland_active_border accent }}\n' >"$themed/tabs.txt.tpl"
|
||||
|
||||
HOME="$home" OMARCHY_PATH="$ROOT" PATH="$ROOT/bin:$PATH" "$ROOT/bin/omarchy-theme-set-templates"
|
||||
HOME="$home" XDG_STATE_HOME="$home/.local/state" OMARCHY_PATH="$ROOT" PATH="$ROOT/bin:$PATH" "$ROOT/bin/omarchy-theme-set-templates"
|
||||
|
||||
# Expected values were produced by the sed-based renderer this replaced, so
|
||||
# every theme keeps rendering byte for byte the same.
|
||||
|
||||
@@ -106,8 +106,30 @@ for virt in vm none; do
|
||||
HOME="$test_home" OMARCHY_PATH="$ROOT" bash "$ROOT/install/user/hardware/vm-no-animations.sh" >/dev/null
|
||||
if [[ $virt == "vm" ]]; then
|
||||
[[ -f $animations_flag ]] || fail "a VM install turns animations off"
|
||||
[[ -f ${animations_flag%/*}/window-opaque.lua ]] || fail "a VM install starts with opaque windows"
|
||||
else
|
||||
[[ ! -f $animations_flag ]] || fail "a machine that is not a VM keeps its animations"
|
||||
[[ ! -f ${animations_flag%/*}/window-opaque.lua ]] || fail "a machine that is not a VM keeps transparent windows"
|
||||
fi
|
||||
done
|
||||
pass "a VM install starts without animations"
|
||||
pass "a VM install starts without animations and with opaque windows"
|
||||
|
||||
# Animations off no longer makes windows opaque. The migration takes that rule
|
||||
# out of a saved flag, keeping anything else in it, and keeps those windows
|
||||
# opaque through Window Transparency instead.
|
||||
migration_home=$(mktemp -d)
|
||||
migration_flags="$migration_home/.local/state/omarchy/toggles/hypr"
|
||||
mkdir -p "$migration_flags"
|
||||
printf 'hl.config({ animations = { enabled = false } })\n\no.window(".*", { opacity = "1 1" })\n-- mine\n' >"$migration_flags/no-animations.lua"
|
||||
for _ in 1 2; do
|
||||
HOME="$migration_home" XDG_STATE_HOME="" OMARCHY_PATH="$ROOT" bash -euo pipefail "$ROOT/migrations/1791705142.sh" >/dev/null
|
||||
done
|
||||
! grep -q 'opacity' "$migration_flags/no-animations.lua" || fail "the migration drops the opacity rule from a saved animations flag"
|
||||
grep -qx -- '-- mine' "$migration_flags/no-animations.lua" || fail "the migration keeps the rest of a saved animations flag"
|
||||
[[ -f $migration_flags/window-opaque.lua ]] || fail "the migration keeps windows opaque where animations are off"
|
||||
rm -f "$migration_flags/window-opaque.lua"
|
||||
printf 'x\n' >"$migration_flags/window-glassy.lua"
|
||||
HOME="$migration_home" XDG_STATE_HOME="" OMARCHY_PATH="$ROOT" bash -euo pipefail "$ROOT/migrations/1791705142.sh" >/dev/null
|
||||
[[ ! -f $migration_flags/window-opaque.lua ]] || fail "the migration leaves a chosen transparency alone"
|
||||
rm -rf "$migration_home"
|
||||
pass "the migration moves opaque windows from the animations flag to Window Transparency"
|
||||
Reference in new issue
Block a user