bootstrap and system config improvements
This commit is contained in:
parent
745075530c
commit
cce3b87edb
17 changed files with 513 additions and 141 deletions
|
|
@ -1,5 +1,14 @@
|
|||
#!/bin/sh
|
||||
|
||||
require() {
|
||||
for cmd in "$@"; do
|
||||
command -v "$cmd" >/dev/null 2>&1 || {
|
||||
echo "theme: missing dependency: $cmd" >&2
|
||||
exit 1
|
||||
}
|
||||
done
|
||||
}
|
||||
|
||||
themes="daylight
|
||||
midnight"
|
||||
|
||||
|
|
@ -11,8 +20,10 @@ Linux)
|
|||
theme="$1"
|
||||
else
|
||||
if [ "$XDG_SESSION_TYPE" = "wayland" ]; then
|
||||
require rofi
|
||||
theme="$(printf "%s\n" "$themes" | rofi -dmenu -p 'theme')"
|
||||
else
|
||||
require dmenu
|
||||
theme="$(printf "%s\n" "$themes" | dmenu -p 'select theme: ')"
|
||||
fi
|
||||
fi
|
||||
|
|
@ -56,9 +67,10 @@ Linux)
|
|||
midnight)
|
||||
gsettings set org.gnome.desktop.interface color-scheme 'prefer-dark'
|
||||
;;
|
||||
*)
|
||||
daylight)
|
||||
gsettings set org.gnome.desktop.interface color-scheme 'prefer-light'
|
||||
;;
|
||||
*) ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
|
|
@ -95,27 +107,27 @@ Darwin)
|
|||
;;
|
||||
esac
|
||||
|
||||
if tmux list-sessions >/dev/null 2>&1; then
|
||||
test -f "$XDG_CONFIG_HOME/tmux/tmux.conf" && tmux source-file "$XDG_CONFIG_HOME/tmux/tmux.conf"
|
||||
[ "$TMUX" ] && tmux refresh-client -S
|
||||
fi
|
||||
|
||||
test -d "$XDG_CONFIG_HOME/fzf/themes" && ln -sf "$XDG_CONFIG_HOME/fzf/themes/$theme" "$XDG_CONFIG_HOME/fzf/themes/theme"
|
||||
test -d "$XDG_CONFIG_HOME/rg/themes" && ln -sf "$XDG_CONFIG_HOME/rg/themes/$theme" "$XDG_CONFIG_HOME/rg/themes/theme"
|
||||
test -d "$XDG_CONFIG_HOME/sioyek/themes" && ln -sf "$XDG_CONFIG_HOME/sioyek/themes/$theme.config" "$XDG_CONFIG_HOME/sioyek/themes/theme.config"
|
||||
test -d "$XDG_CONFIG_HOME/task/themes" && ln -sf "$XDG_CONFIG_HOME/task/themes/$theme.theme" "$XDG_CONFIG_HOME/task/themes/theme.theme"
|
||||
|
||||
if command -v claude >/dev/null 2>&1; then
|
||||
CLAUDE_CONFIG="${CLAUDE_CONFIG_DIR:-$HOME}/.claude.json"
|
||||
claude_theme='light'
|
||||
case "$theme" in
|
||||
daylight)
|
||||
claude config set theme light
|
||||
claude_theme='light'
|
||||
;;
|
||||
midnight)
|
||||
claude config set theme dark
|
||||
claude_theme='dark'
|
||||
;;
|
||||
esac
|
||||
test -f "$CLAUDE_CONFIG" && jq ".theme=\"$claude_theme\"" "$CLAUDE_CONFIG" >"$CLAUDE_CONFIG.tmp" && mv "$CLAUDE_CONFIG.tmp" "$CLAUDE_CONFIG"
|
||||
fi
|
||||
|
||||
test -f ~/.zshenv && sed -i "s|^\(export THEME=\).*|\1$theme|" ~/.zshenv
|
||||
[ -n "$TMUX" ] && tmux setenv -g THEME "$theme"
|
||||
|
||||
for socket in /tmp/nvim-*.sock; do
|
||||
test -S "$socket" && nvim --server "$socket" --remote-expr "luaeval('require(\"config.fzf_reload\").reload()')" 2>/dev/null || true
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue