ADD scripts for changing light and dark themes

This commit is contained in:
Nathan Dwarshuis 2024-03-04 21:18:35 -05:00
parent b0d2df87da
commit 975bff000f
6 changed files with 75 additions and 18 deletions

View File

@ -0,0 +1,24 @@
#!/bin/bash
config=$XDG_CONFIG_HOME/alacritty/alacritty.toml
light=$config.light
dark=$config.dark
if [[ "$1" == "toggle" ]]; then
current=$(readlink $config)
if [ $current == $light ]; then
ln -sf $dark $config
elif [ $current == $dark ]; then
ln -sf $light $config
else
echo 'Invalid link'
exit 1
fi
elif [[ "$1" == "dark" ]]; then
ln -sf $dark $config
elif [[ "$1" == "light" ]]; then
ln -sf $light $config
else
echo 'Invalid command'
exit 1
fi

View File

@ -0,0 +1,22 @@
#!/bin/bash
if [[ "$1" == "toggle" ]]; then
emacs_ctl theme toggle
tmuxctl toggle-theme
alacritty_theme toggle
elif [[ "$1" == "dark" ]]; then
emacs_ctl theme dark
tmuxctl dark-theme
alacritty_theme dark
elif [[ "$1" == "light" ]]; then
emacs_ctl theme light
tmuxctl light-theme
alacritty_theme light
else
echo 'Invalid command'
exit 1
fi
if [[ "$2" == "force" ]]; then
emacs_ctl restart
fi

View File

@ -33,7 +33,7 @@ greenclip daemon &
redshift > /dev/null 2>&1 &
dunst &
{{ if .development.emacs -}}
emacs-start &
emacs_ctl start &
{{- end }}
{{ if .features.seafile -}}
seafile-applet > /dev/null 2>&1 &

View File

@ -11,20 +11,20 @@ draw_bold_text_with_bright_colors = true
[colors.normal]
black = "#000000"
red = "#a00606"
green = "#007700"
red = "#cc0606"
green = "#008000"
yellow = "#969600"
blue = "#0020aa"
magenta = "#cc20cc"
cyan = "#20cccc"
white = "#ffffff"
white = "#fcfcfc"
[colors.bright]
black = "#333333"
red = "#dd3030"
green = "#08aa08"
yellow = "#aaaa10"
red = "#dd1010"
green = "#08a008"
yellow = "#baba00"
blue = "#0040bb"
magenta = "#ff60ff"
cyan = "#1ebbbb"
cyan = "#00b1b1"
white = "#ffffff"

View File

@ -9,8 +9,15 @@ elif [[ "$1" == "start" ]]; then
tmux new-session -s "$session_name" -d
elif [[ "$1" == "stop" ]]; then
tmux kill-session -t "$session_name"
elif [[ "$1" == "toggle-theme" ]]; then
[ $(tmux show -v @dark-theme) == 0 ] && theme=1 || theme=0
tmux set @dark-theme $theme
elif [[ "$1" == "dark-theme" ]]; then
tmux set @dark-theme 1
elif [[ "$1" == "light-theme" ]]; then
tmux set @dark-theme 0
else
echo 'Command must be either "start" or "stop"'
echo 'Invalid command'
exit 1
fi

View File

@ -3,6 +3,8 @@
run-shell 'tmux setenv -g TMUX_VERSION $(tmux -V | \
sed -En "s/^tmux[^0-9]*([.0-9]+).*/\1/p")'
set -g @dark-theme 0
# use vi bindings
set -g status-keys vi
set -g mode-keys vi
@ -77,15 +79,17 @@ bind C-c copy-mode
# theme
# TODO this feel sloppy (don't use an ENVVAR)
status_sep="#[fg=#888888]|#[default]"
set -g status-interval 1
set -g status-left "#h:#S $status_sep "
set -g status-left-length 32
set -g status-style "fg=#cccccc,bg=#444444"
set -g window-status-style "fg=#9f9f9f"
set -g window-status-activity-style "fg=#9f9f9f"
set -g window-status-current-style "fg=#000000 bold,bg=#00ff00"
set -g status-style "#{?@dark-theme,fg=##cccccc#,bg=##444444,fg=##2c2c2c#,bg=##d6d6d6}"
set -g window-status-style "#{?@dark-theme,fg=##9f9f9f,fg=##909090}"
set -g window-status-activity-style "#{?@dark-theme,fg=##9f9f9f,fg=##808080}"
set -g window-status-current-style "#{?@dark-theme,fg=##000000 bold#,bg=##00ff00,fg=##000000 bold#,bg=##00dd00}"
set -g window-status-separator ""
set -g window-status-format " #{?window_activity_flag,##,}#I-#W "
@ -94,13 +98,13 @@ set -g window-status-current-format " #I-#W "
set -g visual-activity off
set -g monitor-activity on
set -g pane-border-style "fg=#444444"
set -g pane-border-style "#{?@dark-theme,fg=##444444,fg=##d6d6d6}"
set -g pane-active-border-style "fg=#aaaaaa"
if-shell -b '[ "$(echo "$TMUX_VERSION >= 3.2" | bc)" = 1 ]' \
"set -g pane-border-lines heavy"
set -g message-style "fg=#ffffaa,bg=#666600"
set -g message-style "#{?@dark-theme,fg=##ffffaa#,bg=##666600,fg=##333300#,bg=##dddd66}"
set -g pane-border-status off
@ -112,9 +116,9 @@ if-shell -b '[ "$(echo "$TMUX_VERSION >= 3.2" | bc)" = 1 ]' \
bind -T root F12 \
set prefix None \;\
set key-table off \;\
set status-style "fg=#aaaaaa,bg=#666666" \;\
set window-status-style "fg=#777777" \;\
set window-status-current-style "fg=#666666 bold,bg=#999999" \;\
set status-style "#{?@dark-mode,fg=##aaaaaa#,bg=##666666,fg=##1c1c1c#,bg=##787878}" \;\
set window-status-style "#{?@dark-mode,fg=##777777,fg=##2c2c2c}" \;\
set window-status-current-style "#{?@dark-mode,fg=##666666 bold#,bg=##999999,fg=##444444 bold#,bg=##999999}" \;\
if -F '#{pane_in_mode}' 'send-keys -X cancel' \;\
refresh-client -S \;\