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
+77
-7
@@ -2,7 +2,7 @@
|
||||
|
||||
# omarchy:summary=Configure the bar and its widget layout
|
||||
# omarchy:group=bar
|
||||
# omarchy:args=use <id> | reset | defaults | position [top|bottom|left|right] | transparent <true|false|toggle> | put <id> [placement] | move <id> [placement] | set <id> <key> <value> [--json] [placement] | get <id> <key>
|
||||
# omarchy:args=use <id> | reset | defaults | position [top|bottom|left|right] | background [opaque|glassy|none|cycle] | put <id> [placement] | move <id> [placement] | set <id> <key> <value> [--json] [placement] | get <id> <key>
|
||||
# omarchy:examples=omarchy bar use local.neon-bar | omarchy bar put omarchy.keyboard-layout --after omarchy.clock | omarchy bar move omarchy.clock --section center --index 0 | omarchy bar set omarchy.clock format HH:mm
|
||||
|
||||
set -euo pipefail
|
||||
@@ -18,7 +18,11 @@ Usage: omarchy bar <command> [args...]
|
||||
defaults Restore the default bar and service widgets
|
||||
position [top|bottom|left|right] Bar position; prints the current one
|
||||
when given none
|
||||
transparent <true|false|toggle> Bar transparency
|
||||
background [opaque|glassy|none|cycle]
|
||||
Bar background: glassy shows what is
|
||||
behind the bar blurred, cycle steps
|
||||
none, glassy, opaque; prints the
|
||||
current one when given none
|
||||
put <id> [placement] Put a widget on the bar, leaving one
|
||||
that is already there where it is
|
||||
move <id> [placement] Move a widget within or between sections
|
||||
@@ -194,6 +198,7 @@ cmd_defaults() {
|
||||
" \
|
||||
--slurpfile defaults "$DEFAULTS_FILE" \
|
||||
--argjson widgets "$optional_widgets"
|
||||
sync_glass || fail "could not change the blur behind the bar"
|
||||
echo "Restored the default Omarchy bar"
|
||||
}
|
||||
|
||||
@@ -210,18 +215,75 @@ cmd_position() {
|
||||
echo "Bar position set to $position"
|
||||
}
|
||||
|
||||
# The bar background is opaque, glassy, or none. A shell.json from before it
|
||||
# had one says transparent instead, which is none, and setting a background
|
||||
# drops it.
|
||||
current_background() {
|
||||
jq -r '.bar.background // (if .bar.transparent == true then "none" else "opaque" end)' "$(source_file)"
|
||||
}
|
||||
|
||||
cmd_background() {
|
||||
if (( $# == 0 )); then
|
||||
current_background
|
||||
return
|
||||
fi
|
||||
|
||||
local background="$1"
|
||||
(( $# == 1 )) || fail "background takes a single value"
|
||||
[[ $background =~ ^(opaque|glassy|none|cycle)$ ]] || fail "background must be opaque, glassy, none, or cycle"
|
||||
|
||||
if [[ $background == "cycle" ]]; then
|
||||
# Each step changes the bar by one degree: clear, then glassy, then opaque.
|
||||
case $(current_background) in
|
||||
none) background="glassy" ;;
|
||||
glassy) background="opaque" ;;
|
||||
*) background="none" ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
local previous
|
||||
previous=$(current_background)
|
||||
commit "$NORMALIZE | .bar.background = \$background | del(.bar.transparent)" --arg background "$background"
|
||||
if ! sync_glass; then
|
||||
commit "$NORMALIZE | .bar.background = \$background | del(.bar.transparent)" --arg background "$previous"
|
||||
fail "could not change the blur behind the bar"
|
||||
fi
|
||||
echo "Bar background set to $background"
|
||||
}
|
||||
|
||||
# The older on/off form of the background, kept for scripts and dotfiles:
|
||||
# transparent is none, and not transparent is opaque.
|
||||
cmd_transparent() {
|
||||
local transparent="${1:-}"
|
||||
[[ -n $transparent ]] || fail "transparent is required"
|
||||
(( $# == 1 )) || fail "transparent takes a single value"
|
||||
[[ $transparent =~ ^(true|false|toggle)$ ]] || fail "transparent must be true, false, or toggle"
|
||||
if [[ $transparent == "toggle" ]]; then
|
||||
commit "$NORMALIZE | .bar.transparent = (.bar.transparent != true)"
|
||||
echo "Bar transparency toggled"
|
||||
else
|
||||
commit "$NORMALIZE | .bar.transparent = \$transparent" --argjson transparent "$transparent"
|
||||
echo "Bar transparency set to $transparent"
|
||||
[[ $(current_background) == "none" ]] && transparent="false" || transparent="true"
|
||||
fi
|
||||
if [[ $transparent == "true" ]]; then
|
||||
cmd_background none
|
||||
else
|
||||
cmd_background opaque
|
||||
fi
|
||||
}
|
||||
|
||||
# Hyprland blurs behind the bar only while the bar-glassy toggle is on, so it
|
||||
# follows the bar background, reloading Hyprland only when it changes. The
|
||||
# toggle sits where Hyprland reads it, under XDG_STATE_HOME.
|
||||
sync_glass() {
|
||||
local dir="${XDG_STATE_HOME:-$HOME/.local/state}/omarchy/toggles/hypr"
|
||||
local flag="$dir/bar-glassy.lua"
|
||||
|
||||
if [[ $(current_background) == "glassy" ]]; then
|
||||
[[ ! -f $flag ]] || return 0
|
||||
mkdir -p "$dir" && cp "$OMARCHY_PATH/default/hypr/toggles/bar-glassy.lua" "$flag" || return 1
|
||||
else
|
||||
[[ -f $flag ]] || return 0
|
||||
rm -f "$flag" || return 1
|
||||
fi
|
||||
|
||||
hyprctl reload >/dev/null 2>&1 || true
|
||||
}
|
||||
|
||||
bar_widget_default_section() {
|
||||
@@ -406,6 +468,14 @@ case "$command" in
|
||||
transparent)
|
||||
cmd_transparent "$@"
|
||||
;;
|
||||
background)
|
||||
cmd_background "$@"
|
||||
;;
|
||||
# Internal: the shell runs this when it loads a bar background, so one set
|
||||
# by editing shell.json gets its blur too.
|
||||
sync-glass)
|
||||
sync_glass || fail "could not change the blur behind the bar"
|
||||
;;
|
||||
put)
|
||||
cmd_put "$@"
|
||||
;;
|
||||
|
||||
Reference in new issue
Block a user