Browse Source

Merge pull request #15 from Krautt/main

[FEATURE] waybar styles with rofi
pull/17/head
Ja.KooLit 2 years ago committed by GitHub
parent
commit
b3aa3bcce0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 47
      config/hypr/scripts/WaybarStyles.sh

47
config/hypr/scripts/WaybarStyles.sh

@ -1,49 +1,38 @@
#!/bin/bash #!/bin/bash
# Check which waybar theme is set # ACTUAL THEME
THEMEIS=$(realpath ~/.config/waybar/style.css | sed 's/.*-\(.*\)\.css/\1/') THEMEIS=$(realpath ~/.config/waybar/style.css | sed 's/.*-\(.*\)\.css/\1/')
# Change theme # Array for the styles
if [ "$THEMEIS" == "default" ]; then STYLES=("default" "b&w" "rgb" "default_alter" "mauve" "light" "dark" "uline")
SWITCHTO="-b&w"
elif [ "$THEMEIS" == "b&w" ]; then # Build ROFI
SWITCHTO="-rgb" SELECTED_STYLE=$(printf "%s\n" "${STYLES[@]}" | rofi -dmenu -p "Choose" -lines "${#STYLES[@]}")
elif [ "$THEMEIS" == "rgb" ]; then
SWITCHTO="-default_alter" # Here you verify the selected theme
elif [ "$THEMEIS" == "default_alter" ]; then if [[ " ${STYLES[@]} " =~ " $SELECTED_STYLE " ]]; then
SWITCHTO="-mauve" SWITCHTO="${SELECTED_STYLE}"
elif [ "$THEMEIS" == "mauve" ]; then
SWITCHTO="-light"
elif [ "$THEMEIS" == "light" ]; then
SWITCHTO="-dark"
elif [ "$THEMEIS" == "dark" ]; then
SWITCHTO="-uline"
elif [ "$THEMEIS" == "uline" ]; then
SWITCHTO="-pywal"
else else
SWITCHTO="-default" echo "It is not valid =c"
exit 1
fi fi
# Set the waybar theme # APPLY THEME
THEMEFILE="$HOME/.config/waybar/style/style${SWITCHTO}.css" THEMEFILE="$HOME/.config/waybar/style/style-${SWITCHTO}.css"
if [ -f "$THEMEFILE" ]; then if [ -f "$THEMEFILE" ]; then
ln -sf "$THEMEFILE" "$HOME/.config/waybar/style.css" ln -sf "$THEMEFILE" "$HOME/.config/waybar/style.css"
else else
echo "Error: $THEMEFILE not found" echo "Error: $THEMEFILE not found"
exit 1 exit 1
fi fi
# Restart waybar
# Kill already running process
_ps=(waybar mako dunst) _ps=(waybar mako dunst)
for _prs in "${_ps[@]}"; do for _prs in "${_ps[@]}"; do
if [[ $(pidof ${_prs}) ]]; then if [[ $(pidof ${_prs}) ]]; then
pkill ${_prs} pkill ${_prs}
fi fi
done done
exec ~/.config/hypr/scripts/Refresh.sh exec ~/.config/hypr/scripts/Refresh.sh

Loading…
Cancel
Save