From 88de9ecc6c4717e349a21f9e8af3ffc0a9d25415 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Sun, 11 Oct 2026 15:25:16 +0200 Subject: [PATCH] Let herdr's tab bar show the terminal background, so it turns glassy too (#15022) Co-authored-by: Claude Opus 5.5 --- config/herdr/config.toml | 9 ++-- migrations/1791722809.sh | 21 ++++++++ .../herdr-glassy-tab-bar-migration-test.sh | 50 +++++++++++++++++++ 3 files changed, 77 insertions(+), 3 deletions(-) create mode 100644 migrations/1791722809.sh create mode 100755 test/shell.d/herdr-glassy-tab-bar-migration-test.sh diff --git a/config/herdr/config.toml b/config/herdr/config.toml index 5c9f0525..a61dde3e 100644 --- a/config/herdr/config.toml +++ b/config/herdr/config.toml @@ -6,9 +6,12 @@ name = "terminal" [theme.custom] -# The active tab is drawn as panel_bg text on an accent background, so panel_bg -# has to be dark for it to read - same colors as status-left's "#[fg=black,bg=blue]" -panel_bg = "black" +# The tab bar sits on the terminal's own background, like tmux's bg=default, so +# it turns see-through with the rest of the terminal under Glassy windows. With +# no panel_bg the active tab's text falls back to surface_dim, so that is black +# for dark text on the accent - same colors as status-left's "#[fg=black,bg=blue]" +panel_bg = "reset" +surface_dim = "black" [terminal] # Matches -c "#{pane_current_path}" on every split, window, and session diff --git a/migrations/1791722809.sh b/migrations/1791722809.sh new file mode 100644 index 00000000..e422969b --- /dev/null +++ b/migrations/1791722809.sh @@ -0,0 +1,21 @@ +echo "Let herdr's tab bar show the terminal's background, so it turns glassy too" + +config="$HOME/.config/herdr/config.toml" + +# Dotfile managers may own the file or a parent directory through a symlink. +# Preserve that layout rather than detaching or editing its target. +path="$config" +while [[ $path != "$HOME" && $path != / ]]; do + if [[ -L $path ]]; then + echo "Preserving symlink-managed herdr config: $config" + exit 0 + fi + path=$(dirname "$path") +done + +# Only a tab bar still on the shipped black changes; any other choice is kept, +# and a surface_dim of the user's own is never given a second one. +if [[ -f $config ]] && grep -qx 'panel_bg = "black"' "$config" && ! grep -q '^[[:space:]]*surface_dim[[:space:]]*=' "$config"; then + sed -i 's/^panel_bg = "black"$/panel_bg = "reset"\nsurface_dim = "black"/' "$config" + omarchy-restart-herdr || true +fi diff --git a/test/shell.d/herdr-glassy-tab-bar-migration-test.sh b/test/shell.d/herdr-glassy-tab-bar-migration-test.sh new file mode 100755 index 00000000..38f08920 --- /dev/null +++ b/test/shell.d/herdr-glassy-tab-bar-migration-test.sh @@ -0,0 +1,50 @@ +#!/bin/bash + +set -euo pipefail + +source "$(dirname "$0")/base-test.sh" + +migration="$ROOT/migrations/1791722809.sh" +test_dir=$(mktemp -d) +trap 'rm -rf "$test_dir"' EXIT + +config="$test_dir/.config/herdr/config.toml" +mkdir -p "${config%/*}" "$test_dir/bin" + +# Reloading herdr would reach the developer's own server. +printf '#!/bin/bash\necho restart >>"$TEST_LOG"\n' >"$test_dir/bin/omarchy-restart-herdr" +chmod +x "$test_dir/bin/omarchy-restart-herdr" + +run_migration() { + : >"$test_dir/log" + HOME="$test_dir" PATH="$test_dir/bin:$PATH" TEST_LOG="$test_dir/log" bash -euo pipefail "$migration" >/dev/null +} + +cp "$ROOT/config/herdr/config.toml" "$test_dir/shipped.toml" +sed -i '/^# The tab bar sits/,/^surface_dim = "black"$/c\# The active tab is drawn as panel_bg text on an accent background\npanel_bg = "black"' "$test_dir/shipped.toml" +cp "$test_dir/shipped.toml" "$config" + +run_migration +grep -qx 'panel_bg = "reset"' "$config" && (( $(grep -c '^surface_dim' "$config") == 1 )) || + fail "the shipped black tab bar takes the terminal background" "$(cat "$config")" +grep -qx restart "$test_dir/log" || fail "herdr reloads after the change" +run_migration +[[ ! -s $test_dir/log ]] || fail "a second run changes nothing" +pass "the shipped black tab bar takes the terminal background, once" + +# A surface_dim of the user's own, indented or not, is kept as the only one. +{ cat "$test_dir/shipped.toml"; printf ' surface_dim = "white"\n'; } >"$config" +cp "$config" "$test_dir/custom.toml" +run_migration +cmp -s "$config" "$test_dir/custom.toml" || fail "an indented surface_dim of the user's own is kept, with no second one" +pass "a surface_dim of the user's own is kept, with no second one" + +# A config a dotfile manager links in is left for it to manage. +mkdir -p "$test_dir/dotfiles" +cp "$test_dir/shipped.toml" "$test_dir/dotfiles/config.toml" +rm "$config" +ln -s "$test_dir/dotfiles/config.toml" "$config" +run_migration +[[ -L $config ]] && cmp -s "$test_dir/dotfiles/config.toml" "$test_dir/shipped.toml" || + fail "a linked herdr config is left linked and unchanged" +pass "a linked herdr config is left alone"