initial commit

This commit is contained in:
Barrett Ruth 2026-02-07 00:45:47 -05:00
commit 23d4795228
99 changed files with 6691 additions and 0 deletions

122
scripts/theme Executable file
View file

@ -0,0 +1,122 @@
#!/bin/sh
themes="daylight
midnight"
as_list="$(printf "%s\n" "$themes" | awk 'NF{printf "\"%s\",", $0}' | sed 's/,$//')"
case "$(uname)" in
Linux)
if [ -n "$1" ]; then
theme="$1"
else
if [ "$XDG_SESSION_TYPE" = "wayland" ]; then
theme="$(printf "%s\n" "$themes" | rofi -dmenu -p 'theme')"
else
theme="$(printf "%s\n" "$themes" | dmenu -p 'select theme: ')"
fi
fi
;;
Darwin)
if [ -n "$1" ]; then
theme="$1"
else
theme="$(
osascript <<EOF
set theList to {$as_list}
set chosenTheme to (choose from list theList ¬
with title "Theme" ¬
with prompt "Pick a theme" ¬
OK button name "Apply" ¬
cancel button name "Cancel" ¬
without empty selection allowed)
if chosenTheme is false then
return ""
else
return item 1 of chosenTheme
end if
EOF
)"
fi
;;
*)
exit 1
;;
esac
[ -z "$theme" ] && exit 1
echo "$themes" | grep -Fxq "$theme" || exit 1
case "$(uname)" in
Linux)
if command -v gsettings >/dev/null 2>&1; then
case "$theme" in
midnight)
gsettings set org.gnome.desktop.interface color-scheme 'prefer-dark'
;;
*)
gsettings set org.gnome.desktop.interface color-scheme 'prefer-light'
;;
esac
fi
[ "$XDG_SESSION_TYPE" = "wayland" ] && {
if [ "$XDG_CURRENT_DESKTOP" = 'Hyprland' ]; then
current_theme=$(readlink "$XDG_CONFIG_HOME/hypr/theme.conf" 2>/dev/null | awk -F/ '{print $NF}' | sed 's/\.conf$//')
if [ "$current_theme" != "$theme" ]; then
ln -sf "$XDG_CONFIG_HOME/hypr/themes/$theme.conf" "$XDG_CONFIG_HOME/hypr/theme.conf"
ln -sf "$XDG_CONFIG_HOME/waybar/themes/$theme.css" "$XDG_CONFIG_HOME/waybar/themes/theme.css"
hyprctl reload
pkill -USR1 waybar
pkill -USR1 waybar
fi
elif [ "$XDG_CURRENT_DESKTOP" = 'sway' ]; then
current_theme=$(readlink "$XDG_CONFIG_HOME/sway/themes/theme" 2>/dev/null | sed 's|.*/||')
if [ "$current_theme" != "$theme" ]; then
test -f "$XDG_CONFIG_HOME/sway/themes/theme" && ln -sf "$XDG_CONFIG_HOME/sway/themes/$theme" "$XDG_CONFIG_HOME/sway/themes/theme"
swaymsg reload
fi
fi
}
test -d "$XDG_CONFIG_HOME/rofi/themes" && ln -sf "$XDG_CONFIG_HOME/rofi/themes/$theme.rasi" "$XDG_CONFIG_HOME/rofi/themes/theme.rasi"
;;
Darwin)
case "$theme" in
daylight)
osascript -e 'tell app "System Events" to tell appearance preferences to set dark mode to false' 2>/dev/null || true
;;
midnight)
osascript -e 'tell app "System Events" to tell appearance preferences to set dark mode to true' 2>/dev/null || true
;;
esac
;;
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/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
case "$theme" in
daylight)
claude config set theme light
;;
midnight)
claude config set theme dark
;;
esac
fi
test -f ~/.zshenv && sed -i "s|^\(export THEME=\).*|\1$theme|" ~/.zshenv
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
done