Let herdr's tab bar show the terminal background, so it turns glassy too (#15022)

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
David Heinemeier HanssonandClaude Opus 5.5 authored and GitHub committed 2026-10-11 22:25:16 +09:00
1 parent 1ac31e55ae
commit 88de9ecc6c
3 files changed
+77 -3

No files matched your search

+6 -3
View File
@@ -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
+21
View File
@@ -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
+50
View File
@@ -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"