Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions bin/omarchy-display-text-size
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ set_terminal_size() {
local pt="$1"

if [[ -f ~/.config/alacritty/alacritty.toml ]]; then
sed -i -E "s/^size[[:space:]]*=.*/size = $pt/" ~/.config/alacritty/alacritty.toml
sed --follow-symlinks -i -E "s/^size[[:space:]]*=.*/size = $pt/" ~/.config/alacritty/alacritty.toml
fi

if [[ -f ~/.config/kitty/kitty.conf ]] || omarchy-cmd-present kitty; then
Expand All @@ -151,12 +151,12 @@ set_terminal_size() {
fi

if [[ -f ~/.config/ghostty/config ]]; then
sed -i -E "s/^font-size = .*/font-size = $pt/" ~/.config/ghostty/config
sed --follow-symlinks -i -E "s/^font-size = .*/font-size = $pt/" ~/.config/ghostty/config
pkill -SIGUSR2 ghostty 2>/dev/null || true
fi

if [[ -f ~/.config/foot/foot.ini ]]; then
sed -i -E "s/(:size=)[0-9.]+/\1$pt/" ~/.config/foot/foot.ini
sed --follow-symlinks -i -E "s/(:size=)[0-9.]+/\1$pt/" ~/.config/foot/foot.ini
# Foot has no config-reload signal, so a running instance keeps its startup
# size until relaunched (new windows pick up the change). Nudge the user —
# but reuse the same notification id (freedesktop replaces_id) so dragging
Expand Down
6 changes: 3 additions & 3 deletions bin/omarchy-font-set
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ if ! fc-list | grep -Fqi -- "$font_name"; then
fi

if [[ -f ~/.config/alacritty/alacritty.toml ]]; then
sed -i "s/family = \".*\"/family = \"$font_name\"/g" ~/.config/alacritty/alacritty.toml
sed --follow-symlinks -i "s/family = \".*\"/family = \"$font_name\"/g" ~/.config/alacritty/alacritty.toml
fi

if [[ -f ~/.config/kitty/kitty.conf ]] || omarchy-cmd-present kitty; then
Expand All @@ -42,7 +42,7 @@ if [[ -f ~/.config/kitty/kitty.conf ]] || omarchy-cmd-present kitty; then
fi

if [[ -f ~/.config/ghostty/config ]]; then
sed -i "s/font-family = \".*\"/font-family = \"$font_name\"/g" ~/.config/ghostty/config
sed --follow-symlinks -i "s/font-family = \".*\"/font-family = \"$font_name\"/g" ~/.config/ghostty/config
pkill -SIGUSR2 ghostty
fi

Expand All @@ -52,7 +52,7 @@ if [[ -f ~/.config/foot/foot.ini ]]; then
if [[ -z $foot_size ]]; then
foot_size=9
fi
sed -i "s/^font=.*/font=$font_name:size=$foot_size/g" ~/.config/foot/foot.ini
sed --follow-symlinks -i "s/^font=.*/font=$font_name:size=$foot_size/g" ~/.config/foot/foot.ini
fi

# fontconfig is the canonical source of truth — the omarchy shell, Qt apps,
Expand Down
46 changes: 46 additions & 0 deletions test/shell.d/terminal-config-symlink-test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#!/bin/bash

set -euo pipefail
source "$(dirname "${BASH_SOURCE[0]}")/base-test.sh"

test_dir=$(mktemp -d)
trap 'rm -rf "$test_dir"' EXIT
test_home="$test_dir/home"
dotfiles="$test_dir/dotfiles"
configs=(alacritty/alacritty.toml ghostty/config foot/foot.ini)
Comment on lines +6 to +10

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Font tests repeat setup

The new test repeats setup already in test/shell.d/kitty-config-test.sh, which runs both font commands. AGENTS.md requires extending the area's existing test rather than adding another *-test.sh. Move these symlink checks into that file before merging so the shared setup stays in one place.

File Used: AGENTS.md (source)

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!


# Link each stock terminal config from a dotfiles checkout, as a dotfiles
# manager would.
for config in "${configs[@]}"; do
mkdir -p "$dotfiles/$(dirname "$config")" "$test_home/.config/$(dirname "$config")"
cp "$ROOT/config/$config" "$dotfiles/$config"
ln -s "$dotfiles/$config" "$test_home/.config/$config"
done

# Exercise the real font commands without changing the running desktop.
mkdir -p "$test_dir/bin"
for command in pkill omarchy-restart-shell omarchy-hook omarchy-notification-send gsettings; do
printf '#!/bin/bash\nexit 0\n' >"$test_dir/bin/$command"
done
printf '#!/bin/bash\nexit 1\n' >"$test_dir/bin/pgrep"
printf '#!/bin/bash\nprintf "Test Font\\n"\n' >"$test_dir/bin/fc-list"
chmod +x "$test_dir/bin/"*

run_command() {
env HOME="$test_home" OMARCHY_PATH="$ROOT" PATH="$test_dir/bin:$ROOT/bin:$PATH" "$ROOT/bin/$@"
}

run_command omarchy-font-set 'Test Font' >/dev/null
run_command omarchy-display-text-size 16 >/dev/null

for config in "${configs[@]}"; do
[[ -L $test_home/.config/$config ]] || fail "$config stays a symlink"
done
pass "font and text size commands keep symlinked terminal configs linked"

grep -q 'family = "Test Font"' "$dotfiles/alacritty/alacritty.toml" || fail "alacritty font lands in the symlink target"
grep -qx 'size = 12' "$dotfiles/alacritty/alacritty.toml" || fail "alacritty size lands in the symlink target"
grep -qx 'font-family = "Test Font"' "$dotfiles/ghostty/config" || fail "ghostty font lands in the symlink target"
grep -qx 'font-size = 12' "$dotfiles/ghostty/config" || fail "ghostty size lands in the symlink target"
grep -qx 'font=Test Font:size=12' "$dotfiles/foot/foot.ini" || fail "foot font and size land in the symlink target"
pass "font and text size changes are written through to the symlink targets"