helix: add script to reload on dark mode change

This commit is contained in:
2025-11-03 23:51:20 +01:00
parent 31e42cc178
commit c2afe72d3f
3 changed files with 20 additions and 0 deletions

15
home/bin/switch-helix-theme.sh Executable file
View File

@@ -0,0 +1,15 @@
#!/usr/bin/env bash
set -euox pipefail
HELIX_CONFIG_PATH=$(readlink -f "${HOME}/.config/helix/config.toml")
HELIX_THEME_LIGHT="zed_onelight"
HELIX_THEME_DARK="kanagawa"
if [[ "$2" == "prefer-dark" ]]; then
sed -i "s/^theme .*/theme = \"$HELIX_THEME_DARK\"/" "$HELIX_CONFIG_PATH"
else
sed -i "s/^theme .*/theme = \"$HELIX_THEME_LIGHT\"/" "$HELIX_CONFIG_PATH"
fi
pkill -USR1 hx || true