From 619c798d40a8ddac43feb5b68426d1e2d0ddefd4 Mon Sep 17 00:00:00 2001 From: krautt Date: Thu, 9 Nov 2023 21:22:10 -0300 Subject: [PATCH 1/2] [FEATURE] waybar styles with rofi --- config/hypr/scripts/WaybarStyles.sh | 49 +++++++++++------------------ 1 file changed, 19 insertions(+), 30 deletions(-) diff --git a/config/hypr/scripts/WaybarStyles.sh b/config/hypr/scripts/WaybarStyles.sh index b6819ed..6cbdced 100755 --- a/config/hypr/scripts/WaybarStyles.sh +++ b/config/hypr/scripts/WaybarStyles.sh @@ -1,49 +1,38 @@ #!/bin/bash -# Check which waybar theme is set +# ACTUAL THEME THEMEIS=$(realpath ~/.config/waybar/style.css | sed 's/.*-\(.*\)\.css/\1/') -# Change theme -if [ "$THEMEIS" == "default" ]; then - SWITCHTO="-b&w" -elif [ "$THEMEIS" == "b&w" ]; then - SWITCHTO="-rgb" -elif [ "$THEMEIS" == "rgb" ]; then - SWITCHTO="-default_alter" -elif [ "$THEMEIS" == "default_alter" ]; then - SWITCHTO="-mauve" -elif [ "$THEMEIS" == "mauve" ]; then - SWITCHTO="-light" -elif [ "$THEMEIS" == "light" ]; then - SWITCHTO="-dark" -elif [ "$THEMEIS" == "dark" ]; then - SWITCHTO="-uline" -elif [ "$THEMEIS" == "uline" ]; then - SWITCHTO="-pywal" +# Array for the styles +STYLES=("default" "b&w" "rgb" "default_alter" "mauve" "light" "dark" "uline" "Purpl") + +# Build ROFI +SELECTED_STYLE=$(printf "%s\n" "${STYLES[@]}" | rofi -dmenu -p "Choose" -lines "${#STYLES[@]}") + +# Here you verify the selected theme +if [[ " ${STYLES[@]} " =~ " $SELECTED_STYLE " ]]; then + SWITCHTO="${SELECTED_STYLE}" else - SWITCHTO="-default" + echo "It is not valid =c" + exit 1 fi -# Set the waybar theme -THEMEFILE="$HOME/.config/waybar/style/style${SWITCHTO}.css" +# APPLY THEME +THEMEFILE="$HOME/.config/waybar/style/style-${SWITCHTO}.css" if [ -f "$THEMEFILE" ]; then ln -sf "$THEMEFILE" "$HOME/.config/waybar/style.css" + else echo "Error: $THEMEFILE not found" exit 1 fi -# Restart waybar -# Kill already running process _ps=(waybar mako dunst) for _prs in "${_ps[@]}"; do - if [[ $(pidof ${_prs}) ]]; then - pkill ${_prs} - fi + if [[ $(pidof ${_prs}) ]]; then + pkill ${_prs} + fi done -exec ~/.config/hypr/scripts/Refresh.sh - - - +exec ~/.config/hypr/scripts/Refresh.sh \ No newline at end of file From 9bad99867b9c5a5ec36cee078833d998fe229a1b Mon Sep 17 00:00:00 2001 From: "Ja.KooLit" Date: Fri, 10 Nov 2023 09:53:07 +0900 Subject: [PATCH 2/2] Update WaybarStyles.sh removing the purpl for now until you submit the new purpl styles... Good job bro :) --- config/hypr/scripts/WaybarStyles.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config/hypr/scripts/WaybarStyles.sh b/config/hypr/scripts/WaybarStyles.sh index 6cbdced..8ce2dec 100755 --- a/config/hypr/scripts/WaybarStyles.sh +++ b/config/hypr/scripts/WaybarStyles.sh @@ -4,7 +4,7 @@ THEMEIS=$(realpath ~/.config/waybar/style.css | sed 's/.*-\(.*\)\.css/\1/') # Array for the styles -STYLES=("default" "b&w" "rgb" "default_alter" "mauve" "light" "dark" "uline" "Purpl") +STYLES=("default" "b&w" "rgb" "default_alter" "mauve" "light" "dark" "uline") # Build ROFI SELECTED_STYLE=$(printf "%s\n" "${STYLES[@]}" | rofi -dmenu -p "Choose" -lines "${#STYLES[@]}") @@ -35,4 +35,4 @@ for _prs in "${_ps[@]}"; do fi done -exec ~/.config/hypr/scripts/Refresh.sh \ No newline at end of file +exec ~/.config/hypr/scripts/Refresh.sh