From 95dda8b1b0bc606a79d00a2e1b2e05a82d4817c1 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Mon, 3 Jun 2024 14:31:35 -0700 Subject: [PATCH] Fixup the font selector --- bin/omakub-font | 27 +++++++++++++-------------- fonts/alacritty/jetbrains-mono.toml | 4 ++++ fonts/alacritty/meslo.toml | 4 ++++ 3 files changed, 21 insertions(+), 14 deletions(-) create mode 100644 fonts/alacritty/jetbrains-mono.toml create mode 100644 fonts/alacritty/meslo.toml diff --git a/bin/omakub-font b/bin/omakub-font index b5cd3e8..f6561cf 100755 --- a/bin/omakub-font +++ b/bin/omakub-font @@ -1,20 +1,19 @@ #!/bin/bash set -e -mkdir -p ~/.local/share/fonts +# Pick a preconfigured theme +FONT=$(gum choose "Cascadia Mono" "Fira Mono" "JetBrains Mono" "Meslo" | tr '[:upper:]' '[:lower:]' | sed 's/ /-/g') -# Pick a preselected font - -if ! [ -f "$HOME/.local/share/fonts/CaskaydiaMonoNerdFont-Regular.ttf" ]; then - cd ~/Downloads - wget https://github.com/ryanoasis/nerd-fonts/releases/download/v3.1.1/CascadiaMono.zip - unzip CascadiaMono.zip -d CascadiaFont - mkdir -p ~/.local/share/fonts - cp CascadiaFont/*.ttf ~/.local/share/fonts - rm -rf CascadiaMono.zip CascadiaFont - fc-cache - cd - +if [ "$FONT" == "cascadia-mono" ]; then + NERD_FONT="CaskaydiaMono Nerd Font" +elif [ "$FONT" == "fira-mono" ]; then + NERD_FONT="FiraMono Nerd Font" +elif [ "$FONT" == "jetbrains-mono" ]; then + NERD_FONT="JetBrainsMono NFM" +elif [ "$FONT" == "meslo" ]; then + NERD_FONT="MesloLGLDZ Nerd Font" fi -# Replace font = { family: X } -gsettings set org.gnome.desktop.interface monospace-font-name 'CaskaydiaMono Nerd Font 10' +gsettings set org.gnome.desktop.interface monospace-font-name "$NERD_FONT 10" +cp $OMAKUB_PATH/fonts/alacritty/$FONT.toml ~/.config/alacritty/font.toml +sed -i "s/\"editor.fontFamily\": \".*\"/\"editor.fontFamily\": \"$NERD_FONT\"/g" ~/.config/Code/User/settings.json diff --git a/fonts/alacritty/jetbrains-mono.toml b/fonts/alacritty/jetbrains-mono.toml new file mode 100644 index 0000000..349a43e --- /dev/null +++ b/fonts/alacritty/jetbrains-mono.toml @@ -0,0 +1,4 @@ +[font] +normal = { family = "JetBrainsMono Nerd Font", style = "Regular" } +bold = { family = "JetBrainsMono Nerd Font", style = "Bold" } +italic = { family = "JetBrainsMono Nerd Font", style = "Italic" } diff --git a/fonts/alacritty/meslo.toml b/fonts/alacritty/meslo.toml new file mode 100644 index 0000000..a70953f --- /dev/null +++ b/fonts/alacritty/meslo.toml @@ -0,0 +1,4 @@ +[font] +normal = { family = "MesloLGLDZ Nerd Font", style = "Regular" } +bold = { family = "MesloLGLDZ Nerd Font", style = "Bold" } +italic = { family = "MesloLGLDZ Nerd Font", style = "Italic" }