From fc42917eb72222661139f05333cbda932f1181cc Mon Sep 17 00:00:00 2001 From: Marc Date: Mon, 24 Aug 2020 10:56:50 +0200 Subject: [PATCH] added polybar theme toggler --- .config/polybar/config.ini | 2 +- .config/polybar/themes/onehalf-dark.ini | 8 ++++++++ .config/polybar/themes/onehalf-light.ini | 8 ++++++++ .config/scripts/toggle_theme.sh | 19 +++++++++++++++++++ 4 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 .config/polybar/themes/onehalf-dark.ini create mode 100644 .config/polybar/themes/onehalf-light.ini diff --git a/.config/polybar/config.ini b/.config/polybar/config.ini index 7c8e562..614874a 100644 --- a/.config/polybar/config.ini +++ b/.config/polybar/config.ini @@ -4,7 +4,7 @@ margin-bottom = 0 margin-top = 0 -include-file = ~/.config/polybar/colors.ini +include-file = ~/.config/polybar/themes/current.ini include-file = ~/.config/polybar/modules.ini include-file = ~/.config/polybar/user_modules.ini diff --git a/.config/polybar/themes/onehalf-dark.ini b/.config/polybar/themes/onehalf-dark.ini new file mode 100644 index 0000000..69b7d60 --- /dev/null +++ b/.config/polybar/themes/onehalf-dark.ini @@ -0,0 +1,8 @@ +;; based on papercolor-light + +[color] + +background = #282c34 +foreground = #dcdfe4 +accent = #98c379 +attention = #e08c75 diff --git a/.config/polybar/themes/onehalf-light.ini b/.config/polybar/themes/onehalf-light.ini new file mode 100644 index 0000000..6171bf8 --- /dev/null +++ b/.config/polybar/themes/onehalf-light.ini @@ -0,0 +1,8 @@ +;; based on onehalf-light + +[color] + +background = #fafafa +foreground = #383a42 +accent = #40a14f +attention = #e45649 diff --git a/.config/scripts/toggle_theme.sh b/.config/scripts/toggle_theme.sh index 30c5587..7680511 100755 --- a/.config/scripts/toggle_theme.sh +++ b/.config/scripts/toggle_theme.sh @@ -9,6 +9,25 @@ # ncmpcpp? uses xresources, but might want customizations # nvim +#polybar + +PATH_THEME="$XDG_CONFIG_HOME/polybar/themes" + +case "$1" in + light) + cp "$PATH_THEME/onehalf-light.ini" "$PATH_THEME/current.ini" + ;; + dark) + cp "$PATH_THEME/onehalf-dark.ini" "$PATH_THEME/current.ini" + ;; +esac + +if pgrep -u $UID -x polybar >/dev/null; then + killall -q polybar + polybar -c ~/.config/polybar/config.ini main & + polybar -c ~/.config/polybar/config.ini system & +fi + #x11 PATH_THEME="$XDG_CONFIG_HOME/X11/colors"