Pull the font-menu into omarchy-menu

This commit is contained in:
David Heinemeier Hansson 2025-08-06 15:50:51 +02:00
parent 58fbda80ef
commit bade5b0d34
4 changed files with 43 additions and 18 deletions

3
bin/omarchy-font-list Executable file
View File

@ -0,0 +1,3 @@
#!/bin/bash
fc-list :spacing=100 -f "%{family[0]}\n" | grep -v -i -E 'emoji|signwriting' | sort -u

View File

@ -1,16 +0,0 @@
#!/bin/bash
~/.local/share/omarchy/bin/omarchy-show-logo
font=$(
fc-list :spacing=100 -f "%{family[0]}\n" |
grep -v -i -E 'emoji|signwriting' |
sort -u |
gum choose --header "Choose terminal font"
)
if [[ -n "$font" ]]; then
sed -i "s/family = \".*\"/family = \"$font\"/g" ~/.config/alacritty/alacritty.toml
fi
~/.local/share/omarchy/bin/omarchy-show-done

14
bin/omarchy-font-set Executable file
View File

@ -0,0 +1,14 @@
#!/bin/bash
font_name="$1"
if [[ -n "$font_name" && "$font_name" != "CNCLD" ]]; then
if fc-list | grep -iq "$font_name"; then
sed -i "s/family = \".*\"/family = \"$font_name\"/g" ~/.config/alacritty/alacritty.toml
else
echo "Font '$font_name' not found."
exit 1
fi
else
echo "Usage: omarchy-font-set <font-name>"
fi

View File

@ -3,7 +3,7 @@
OMARCHY_BIN_PATH=~/.local/share/omarchy/bin
menu() {
echo -e "$2" | walker --dmenu --theme dmenu_250 -p "$1…"
echo -e "$2" | walker --dmenu --theme dmenu_250 -p "$1…" $3
}
terminal() {
@ -23,6 +23,10 @@ install_and_launch() {
present_terminal "echo 'Installing $1...'; yay -Sy --noconfirm $2 && gtk-launch $3"
}
install_font() {
present_terminal "echo 'Installing $1...'; yay -Sy --noconfirm $2 && ~/.local/share/omarchy/bin/omarchy-font-set "$3""
}
show_learn_menu() {
case $(menu "Learn" " Keybindings\n Omarchy\n Hyprland\n󰣇 Arch\n Neovim\n󱆃 Bash") in
*Keybindings*) $OMARCHY_BIN_PATH/omarchy-menu-keybindings ;;
@ -38,7 +42,7 @@ show_learn_menu() {
show_style_menu() {
case $(menu "Style" "󰸌 Theme\n Font\n Background") in
*Theme*) show_theme_menu ;;
*Font*) terminal $OMARCHY_BIN_PATH/omarchy-font-menu ;;
*Font*) show_font_menu ;;
*Background*) $OMARCHY_BIN_PATH/omarchy-theme-bg-next ;;
*) show_main_menu ;;
esac
@ -53,6 +57,15 @@ show_theme_menu() {
fi
}
show_font_menu() {
theme=$(menu "Font" "$($OMARCHY_BIN_PATH/omarchy-font-list)" "-w 350")
if [[ "$theme" == "CNCLD" || -z "$theme" ]]; then
show_main_menu
else
$OMARCHY_BIN_PATH/omarchy-font-set "$theme"
fi
}
show_capture_menu() {
case $(menu "Capture" " Screenshot\n Screenrecord\n󰃉 Color") in
*Screenshot*) show_screenshot_menu ;;
@ -146,6 +159,17 @@ show_install_editor_menu() {
esac
}
show_install_font_menu() {
case $(menu "Install" " Meslo LG Mono") in
*Meslo*) install_font "VSCode" "visual-studio-code-bin" "code" ;;
*Fira*) install_and_launch "Fira Code" "ttf-firacode-nerd" "FiraCode Nerd Font" ;;
*Victor*) install_font "Victor Code" "ttf-victor-mono-nerd" "VictorMono Nerd Font" ;;
*Victor*) install_and_launch "Zed" "zed" "dev.zed.Zed" ;;
*Bitstream*) install_and_launch "Zed" "zed" "dev.zed.Zed" ;;
*) show_install_menu ;;
esac
}
show_remove_menu() {
case $(menu "Remove" "󰣇 Package\n Web App\n󰸌 Theme\n󰈷 Fingerprint\n Fido2") in
*Package*) terminal $OMARCHY_BIN_PATH/omarchy-pkg-remove ;;