Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
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
71 changes: 4 additions & 67 deletions bin/omarchy-display-text-size
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
# • the terminal font point size (12px -> 9pt, so terminal_pt = px * 9/12)
# The shell override layers on top of the active theme (so the size survives
# theme switches) and the shell watches the file, so shell text re-flows live.
# The terminal side goes through omarchy-font-size, which also sets it alone.
# Accepts an integer from 9 to 20 (px).

MIN=9
Expand Down Expand Up @@ -133,70 +134,6 @@ term_pt_for() {
'BEGIN { printf "%d", int(s * p / b + 0.5) }'
}

# Set the font point size in terminal configs, creating Kitty overrides when
# it inherits its size from the system config. Family is left
# untouched — that is omarchy-font-set's job. Live-reload signals mirror
# omarchy-font-set; foot has no reload signal, so running instances are nudged.
set_terminal_size() {
local pt="$1"

if [[ -f ~/.config/alacritty/alacritty.toml ]]; then
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
mkdir -p ~/.config/kitty
if grep -qE '^[[:space:]]*font_size[[:space:]]+' ~/.config/kitty/kitty.conf 2>/dev/null; then
sed --follow-symlinks -i -E "s/^[[:space:]]*font_size[[:space:]]+.*/font_size $pt.0/" ~/.config/kitty/kitty.conf
else
printf '\nfont_size %s.0\n' "$pt" >>~/.config/kitty/kitty.conf
fi
pkill -USR1 kitty 2>/dev/null || true
fi

if [[ -f ~/.config/ghostty/config ]]; then
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 --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
# through several sizes refreshes one toast instead of stacking a pile.
if pgrep -x foot >/dev/null 2>&1; then
local id_file="${XDG_RUNTIME_DIR:-/tmp}/omarchy-display-text-size.foot-notif-id"
local prev_id=""
[[ -f $id_file ]] && read -r prev_id <"$id_file" 2>/dev/null
local replace=()
[[ $prev_id =~ ^[0-9]+$ ]] && replace=(-r "$prev_id")
local new_id
new_id="$(omarchy-notification-send \
"$(omarchy-i18n display.restartFootForFontSize)" \
"${replace[@]}" -p 2>/dev/null)" || true
[[ $new_id =~ ^[0-9]+$ ]] && printf '%s\n' "$new_id" >"$id_file"
fi
fi
}

# Report the current terminal point size from whichever config we find first.
term_current_pt() {
if [[ -f ~/.config/ghostty/config ]]; then
grep -oP '^font-size = \K[0-9.]+' ~/.config/ghostty/config | head -1
elif [[ -f ~/.config/alacritty/alacritty.toml ]]; then
grep -oP '^size[[:space:]]*=[[:space:]]*\K[0-9.]+' ~/.config/alacritty/alacritty.toml | head -1
elif [[ -f ~/.config/kitty/kitty.conf ]]; then
local pt
pt=$(grep -oP '^[[:space:]]*font_size[[:space:]]+\K[0-9.]+' ~/.config/kitty/kitty.conf | tail -1)
echo "${pt:-$TERM_DEFAULT_PT}"
elif [[ -f ~/.config/foot/foot.ini ]]; then
grep -oP ':size=\K[0-9.]+' ~/.config/foot/foot.ini | head -1
elif omarchy-cmd-present kitty; then
echo "$TERM_DEFAULT_PT"
fi
}

case "${1:-}" in
-h | --help)
usage
Expand All @@ -206,15 +143,15 @@ case "${1:-}" in
cur="$(current_base_size)"
size="${cur:-12 (default)}"
factor="$(gsettings get "$GKEY_SCHEMA" "$GKEY_NAME" 2>/dev/null)"
term="$(term_current_pt)"
term="$(omarchy-font-size)"
printf 'text size: %s px\ngtk text-scaling-factor: %s\nterminal font: %s pt\n' \
"$size" "$factor" "${term:-n/a}"
exit 0
;;
reset | default)
reset_base_size
gsettings reset "$GKEY_SCHEMA" "$GKEY_NAME" 2>/dev/null || true
set_terminal_size "$TERM_DEFAULT_PT"
omarchy-font-size reset
exit 0
;;
esac
Expand All @@ -237,4 +174,4 @@ factor="$(awk -v s="$size" -v b="$SHELL_DEFAULT_PX" -v f="$(gtk_font_pt)" \
set_factor "$factor"

# Terminal side: point size anchored so 12px == 9pt.
set_terminal_size "$(term_pt_for "$size")"
omarchy-font-size "$(term_pt_for "$size")"
108 changes: 108 additions & 0 deletions bin/omarchy-font-size
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
#!/bin/bash

# omarchy:summary=Show or set the terminal font size
# omarchy:args=[size|reset]
# omarchy:examples=omarchy font size | omarchy font size 12 | omarchy font size reset

# Sets the font point size in every terminal config Omarchy manages: Alacritty,
# Ghostty, Kitty and Foot. The font family is omarchy-font-set's job, and
# omarchy-display-text-size calls this to keep terminals in proportion with the
# shell and GTK, so a size set here lasts until the next desktop text size change.
# Accepts an integer from 6 to 24 (pt).

MIN=6
MAX=24
DEFAULT_PT=9

usage() {
echo "Usage: omarchy-font-size [size|reset]"
echo " (no args) print the current terminal font size in pt"
echo " <size> set the terminal font size in pt ($MIN–$MAX)"
echo " reset return terminals to the default ${DEFAULT_PT}pt"
}

# Set the font point size in terminal configs, creating Kitty overrides when
# it inherits its size from the system config. Live-reload signals mirror
# omarchy-font-set; foot has no reload signal, so running instances are nudged.
set_terminal_size() {
local pt="$1"

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

if [[ -f ~/.config/kitty/kitty.conf ]] || omarchy-cmd-present kitty; then
mkdir -p ~/.config/kitty
if grep -qE '^[[:space:]]*font_size[[:space:]]+' ~/.config/kitty/kitty.conf 2>/dev/null; then
sed --follow-symlinks -i -E "s/^[[:space:]]*font_size[[:space:]]+.*/font_size $pt.0/" ~/.config/kitty/kitty.conf
else
printf '\nfont_size %s.0\n' "$pt" >>~/.config/kitty/kitty.conf
fi
pkill -USR1 kitty 2>/dev/null || true
fi

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

if [[ -f ~/.config/foot/foot.ini ]]; then
# Foot keeps fallback fonts after the primary on the same line; change only
# the primary font's size, not a fallback's.
sed --follow-symlinks -i -E "/^font=/ s/(:size=)[0-9.]+/\1$pt/" ~/.config/foot/foot.ini
Comment thread
greptile-apps[bot] marked this conversation as resolved.
Resolved
# 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
# through several sizes refreshes one toast instead of stacking a pile.
if pgrep -x foot >/dev/null 2>&1; then
local id_file="${XDG_RUNTIME_DIR:-/tmp}/omarchy-font-size.foot-notif-id"
local prev_id=""
[[ -f $id_file ]] && read -r prev_id <"$id_file" 2>/dev/null
local replace=()
[[ $prev_id =~ ^[0-9]+$ ]] && replace=(-r "$prev_id")
local new_id
new_id="$(omarchy-notification-send \
"$(omarchy-i18n display.restartFootForFontSize)" \
"${replace[@]}" -p 2>/dev/null)" || true
[[ $new_id =~ ^[0-9]+$ ]] && printf '%s\n' "$new_id" >"$id_file"
fi
fi
}

# Print the current terminal point size from whichever config we find first.
current_size() {
if [[ -f ~/.config/ghostty/config ]]; then
grep -oP '^[[:space:]]*font-size[[:space:]]*=[[:space:]]*\K[0-9.]+' ~/.config/ghostty/config | head -1
elif [[ -f ~/.config/alacritty/alacritty.toml ]]; then
grep -oP '^[[:space:]]*size[[:space:]]*=[[:space:]]*\K[0-9.]+' ~/.config/alacritty/alacritty.toml | head -1
elif [[ -f ~/.config/kitty/kitty.conf ]]; then
local pt
pt=$(grep -oP '^[[:space:]]*font_size[[:space:]]+\K[0-9.]+' ~/.config/kitty/kitty.conf | tail -1)
echo "${pt:-$DEFAULT_PT}"
elif [[ -f ~/.config/foot/foot.ini ]]; then
grep -oP ':size=\K[0-9.]+' ~/.config/foot/foot.ini | head -1
elif omarchy-cmd-present kitty; then
echo "$DEFAULT_PT"
fi
}

case "${1:-}" in
-h | --help)
usage
;;
"")
current_size
;;
reset | default)
set_terminal_size "$DEFAULT_PT"
;;
*)
if [[ $1 =~ ^[0-9]+$ ]] && ((10#$1 >= MIN && 10#$1 <= MAX)); then
set_terminal_size "$((10#$1))"
else
echo "Size must be an integer between $MIN and $MAX (pt)." >&2
usage >&2
exit 1
fi
;;
esac
1 change: 1 addition & 0 deletions default/agents/skills/omarchy/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,7 @@ This skill intentionally does not cover Omarchy source development. Do not use t
- "Add a Danish keyboard layout" -> `kb_layout = "us,dk"` in `~/.config/hypr/input.lua` (or `omarchy setup keyboard`)
- "Set an environment variable for all apps" -> A file in `~/.config/uwsm/env.d/`, applied at next login
- "Make text bigger everywhere" -> `omarchy display text size <9-20>`
- "Make only the terminal font bigger" -> `omarchy font size <6-24>`
- "Set a reminder to pickup jack in 15 minutes" -> `omarchy reminder 15 "Pickup Jack"`
- "Show my reminders" -> `omarchy reminder show`
- "Clear all reminders" -> `omarchy reminder clear`
Expand Down
3 changes: 2 additions & 1 deletion default/agents/skills/omarchy/theming.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,11 @@ omarchy theme set catppuccin-custom
omarchy font list # Available fonts
omarchy font current # Current font
omarchy font set <name> # Change the monospace font used everywhere
omarchy font size [size|reset] # Terminal font size in pt (6–24, default 9)
omarchy font cjk [jp|kr|sc|tc|hk|default] # Glyph forms for Chinese, Japanese, and Korean text
```

`omarchy font list` shows installed Nerd Fonts; a new one comes from the menu's Install > Style > Font, or `omarchy install font <display-name> <package> <family>`.
`omarchy font list` shows installed Nerd Fonts; a new one comes from the menu's Install > Style > Font, or `omarchy install font <display-name> <package> <family>`. `omarchy font size` changes only the terminal; `omarchy display text size` scales the whole desktop.

## App Icons

Expand Down
2 changes: 1 addition & 1 deletion manual/33-monitors.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Monitor scaling changes the size of everything. If all you want is bigger or sma
omarchy display text size 14
```

That takes a pixel size between 9 and 20, and moves the Omarchy shell, GTK applications, and your terminal together, so the whole desktop stays in proportion. Run it without an argument to see where you're at, and `omarchy display text size reset` to go back to the default. Foot is the one straggler: it has no way to reload its config, so running terminals keep their old size until you open a new one.
That takes a pixel size between 9 and 20, and moves the Omarchy shell, GTK applications, and your terminal together, so the whole desktop stays in proportion. Run it without an argument to see where you're at, and `omarchy display text size reset` to go back to the default. Foot is the one straggler: it has no way to reload its config, so running terminals keep their old size until you open a new one. To change only the terminal, use `omarchy font size` (see [Fonts](38-fonts.md)).

### Extending and mirroring laptop displays

Expand Down
6 changes: 6 additions & 0 deletions manual/38-fonts.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ You can change this through the _Appearance > Font_ menu in the Omarchy menu (`S

You can install other popular programming fonts via _Install > Style > Font_ in the Omarchy menu: Cascadia Mono, Meslo LG Mono, Fira Code, Victor Code, Bitstream Vera Mono, and Iosevka are all one click away, in their Nerd Font versions so the glyphs in the bar and terminal keep working. Installing one also switches the whole system to it, and you can switch back any time under _Appearance > Font_.

## Terminal font size

The terminal font is 9pt by default. To make only the terminal bigger or smaller, run `omarchy font size 12` (any whole size from 6 to 24), `omarchy font size` to see the current one, and `omarchy font size reset` to go back to 9pt. It changes Alacritty, Ghostty, Kitty, and Foot together and leaves the bar, menus, and apps alone. Running terminals pick it up right away, except Foot, which needs a new window.

To scale text across the whole desktop instead, use `omarchy display text size` (see [Monitors](33-monitors.md)). That sets the terminal too, in proportion with everything else, so run `omarchy font size` after it if you want the terminal to differ.

## Chinese, Japanese, and Korean

Chinese, Japanese, and Korean share many characters but draw some of them differently, so the same character looks right to one reader and foreign to another. Picking one of these languages under _Setup > Region > Language_, or its input method, sets the matching forms. To choose them yourself, run `omarchy font cjk jp`, `kr`, `sc`, `tc` (Taiwan), or `hk` (Hong Kong) in a terminal; `omarchy font cjk default` goes back to the system's choice, which is Japanese forms. Text a web page or document marks with its own language, and the whole desktop while it is in one of these languages, keeps that language's forms.
101 changes: 101 additions & 0 deletions test/shell.d/font-size-test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
#!/bin/bash

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

test_dir=$(mktemp -d)
trap 'rm -rf "$test_dir"' EXIT
test_home="$test_dir/home"
stubs="$test_dir/bin"
calls="$test_dir/calls.log"
mkdir -p "$stubs" "$test_home/.config"/{alacritty,ghostty,kitty,foot}

cp "$ROOT/config/alacritty/alacritty.toml" "$test_home/.config/alacritty/alacritty.toml"
cp "$ROOT/config/ghostty/config" "$test_home/.config/ghostty/config"
cp "$ROOT/config/kitty/kitty.conf" "$test_home/.config/kitty/kitty.conf"
cp "$ROOT/config/foot/foot.ini" "$test_home/.config/foot/foot.ini"
Comment thread
greptile-apps[bot] marked this conversation as resolved.
Resolved

# Nothing may signal or notify the real session. pgrep reports no running
# terminals; fc-list knows one font, for omarchy-font-set.
for name in pkill gsettings omarchy-notification-send omarchy-restart-shell omarchy-hook; do
printf '#!/bin/bash\nprintf "%s %%s\\n" "$*" >>"%s"\n' "$name" "$calls" >"$stubs/$name"
done
printf '#!/bin/bash\nexit 1\n' >"$stubs/pgrep"
printf '#!/bin/bash\necho "/usr/share/fonts/Test.ttf: Test Mono:style=Regular"\n' >"$stubs/fc-list"
chmod +x "$stubs"/*

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

sizes() {
printf '%s|%s|%s|%s' \
"$(grep -oP '^size = \K.*' "$test_home/.config/alacritty/alacritty.toml")" \
"$(grep -oP '^font-size = \K.*' "$test_home/.config/ghostty/config")" \
"$(grep -oP '^font_size \K.*' "$test_home/.config/kitty/kitty.conf" | tail -1)" \
"$(grep -oP ':size=\K[0-9.]+' "$test_home/.config/foot/foot.ini")"
}

[[ $(run omarchy font size) == "9" ]] || fail "reports the stock terminal size" "$(run omarchy font size)"
pass "reports the stock terminal size"

run omarchy font size 12
[[ $(sizes) == "12|12|12.0|12" ]] || fail "sets every terminal's size" "$(sizes)"
[[ $(run omarchy font size) == "12" ]] || fail "reads back the new size"
grep -q 'font-family = "JetBrainsMono Nerd Font"' "$test_home/.config/ghostty/config" || fail "leaves the font family alone"
grep -q '^font=JetBrainsMono Nerd Font:size=12' "$test_home/.config/foot/foot.ini" || fail "leaves Foot's font family alone"
grep -q '^pkill -SIGUSR2 ghostty' "$calls" || fail "reloads Ghostty"
grep -q '^pkill -USR1 kitty' "$calls" || fail "reloads Kitty"
! grep -q '^gsettings' "$calls" || fail "leaves GTK text scaling alone"
[[ ! -e $test_home/.config/omarchy/shell.toml ]] || fail "leaves the shell text size alone"
pass "sets only the terminal size, in every terminal"

run omarchy font size 08
[[ $(sizes) == "8|8|8.0|8" ]] || fail "reads a leading zero as decimal" "$(sizes)"
pass "reads a leading zero as decimal"

for bad in 5 25 abc 1.5; do
if run omarchy font size "$bad" 2>/dev/null; then
fail "rejects $bad"
fi
done
[[ $(sizes) == "8|8|8.0|8" ]] || fail "a rejected size changes nothing" "$(sizes)"
pass "rejects sizes outside 6–24 and non-integers"

run omarchy font size reset
[[ $(sizes) == "9|9|9.0|9" ]] || fail "reset returns to 9pt" "$(sizes)"
pass "reset returns to 9pt"

: >"$calls"
run omarchy display text size 16
[[ $(sizes) == "12|12|12.0|12" ]] || fail "desktop text size keeps terminals in proportion" "$(sizes)"
grep -q '^gsettings set org.gnome.desktop.interface text-scaling-factor' "$calls" || fail "desktop text size still scales GTK"
grep -q '^base-size = 16' "$test_home/.config/omarchy/shell.toml" || fail "desktop text size still scales the shell"
[[ $(run omarchy display text size) == *"terminal font: 12 pt"* ]] || fail "desktop text size reports the terminal size"
pass "desktop text size sets terminals through omarchy-font-size"

run omarchy font size 14
run omarchy font set "Test Mono"
grep -q '^font=Test Mono:size=14' "$test_home/.config/foot/foot.ini" || fail "changing the font keeps Foot's size" "$(grep '^font=' "$test_home/.config/foot/foot.ini")"
pass "changing the font keeps Foot's size"

# Terminal configs can be symlinked from dotfiles. The size must be written
# through the link, not replace it.
mkdir -p "$test_home/dotfiles"
for pair in "alacritty/alacritty.toml alacritty.toml" \
"ghostty/config ghostty.conf" \
"kitty/kitty.conf kitty.conf" \
"foot/foot.ini foot.ini"; do
read -r source_rel target_rel <<<"$pair"
source_file="$test_home/.config/$source_rel"
target_file="$test_home/dotfiles/$target_rel"
mv "$source_file" "$target_file"
ln -s "$target_file" "$source_file"
done

run omarchy font size 13
[[ $(sizes) == "13|13|13.0|13" ]] || fail "writes the size through symlinked configs" "$(sizes)"
for link in alacritty/alacritty.toml ghostty/config kitty/kitty.conf foot/foot.ini; do
[[ -L $test_home/.config/$link ]] || fail "keeps $link a symlink"
done
pass "writes through symlinked terminal configs"