Files
Nomarchy/themes/engine/scripts/nomarchy-font-set
Bernardo Magri dc3346bc55
Some checks failed
Check / eval-and-lint (push) Has been cancelled
feat: implement hybrid declarative state with automatic Nix sync
2026-05-31 20:09:12 +01:00

51 lines
1.2 KiB
Bash
Executable File

#!/usr/bin/env bash
set -e
# Set the system-wide monospace font that should be used by the terminal, hyprlock, waybar, swayosd, etc.
# Declarative version for Nomarchy NixOS.
# Usage: nomarchy-font-set <font-name> [--no-update]
font_name="$1"
no_update=false
if [[ "${2:-}" == "--no-update" ]]; then
no_update=true
fi
if [[ -z $font_name ]]; then
echo "Usage: nomarchy-font-set <font-name> [--no-update]"
exit 1
fi
STATE_DIR="$HOME/.config/nomarchy"
STATE_FILE="$STATE_DIR/state.json"
mkdir -p "$STATE_DIR"
[[ ! -f $STATE_FILE ]] && echo "{}" > "$STATE_FILE"
if fc-list | grep -iq "$font_name"; then
nomarchy-state-write font "$font_name"
echo "Font set to $font_name. Applying changes with nomarchy-env-update..."
if [[ "$no_update" == "true" ]]; then
echo "Skipping nomarchy-env-update due to --no-update flag."
exit 0
fi
nomarchy-env-update
# Instant feedback for certain apps via IPC
if pgrep -x kitty; then
pkill -USR1 kitty
fi
if pgrep -x ghostty; then
pkill -SIGUSR2 ghostty
notify-send -u low " You must restart Ghostty to see font change"
fi
nomarchy-hook font-set "$font_name"
else
echo "Font '$font_name' not found."
exit 1
fi