diff options
Diffstat (limited to 'config/hypr/scripts')
| -rwxr-xr-x | config/hypr/scripts/WaybarLayout.sh | 29 | ||||
| -rwxr-xr-x | config/hypr/scripts/WaybarStyles.sh | 89 |
2 files changed, 50 insertions, 68 deletions
diff --git a/config/hypr/scripts/WaybarLayout.sh b/config/hypr/scripts/WaybarLayout.sh index 15d9195f..dd5fc387 100755 --- a/config/hypr/scripts/WaybarLayout.sh +++ b/config/hypr/scripts/WaybarLayout.sh @@ -4,24 +4,15 @@ CONFIG="$HOME/.config/waybar/configs" WCONFIG="$HOME/.config/waybar/config" menu() { - cat <<EOF -default -default-Bottom -Peony -Chrysanthemum -Gardenia -Camellia -simple-long -simple-short -Top-&-Bottom -Left -Right -Top-Left -Top-Right -Bottom-Left -Bottom-Right -no panel -EOF + # List only files (excluding directories) in the directory and sort alphabetically + options=() + while IFS= read -r file; do + if [ -f "$CONFIG/$file" ]; then + options+=("$file") + fi + done < <(find "$CONFIG" -maxdepth 1 -type f -exec basename {} \; | sort) + + printf '%s\n' "${options[@]}" } apply_config() { @@ -29,7 +20,7 @@ apply_config() { } main() { - choice=$(menu | rofi -dmenu -config ~/.config/rofi/config-waybar.rasi) + choice=$(menu | rofi -dmenu -config ~/.config/rofi/config-waybar-layout.rasi) if [[ -z "$choice" ]]; then echo "No option selected. Exiting." diff --git a/config/hypr/scripts/WaybarStyles.sh b/config/hypr/scripts/WaybarStyles.sh index a861e620..de3a54dc 100755 --- a/config/hypr/scripts/WaybarStyles.sh +++ b/config/hypr/scripts/WaybarStyles.sh @@ -1,58 +1,49 @@ #!/bin/bash -# ACTUAL THEME -THEMEIS=$(realpath ~/.config/waybar/style.css | sed 's/.*-\(.*\)\.css/\1/') +CONFIG="$HOME/.config/waybar/style" +WCONFIG="$HOME/.config/waybar/style.css" -# Array for the styles -STYLES=( -"Purpl" -"Crimson" -"Golden-Noir" -"Simple-Pink" -"pywal" -"dark" -"light" -"Black-&-White" -"colors" -"colors-border" -"colors-line" -"colorful" -"Catppuccin-Mocha" -"Catppuccin-Latte" -"Transparent" -) +menu() { + # List only files (excluding directories) in the directory and sort alphabetically + options=() + while IFS= read -r file; do + if [ -f "$CONFIG/$file" ]; then + options+=("$(basename "$file" .css)") + fi + done < <(find "$CONFIG" -maxdepth 1 -type f -name '*.css' -exec basename {} \; | sort) + + printf '%s\n' "${options[@]}" +} -# Build ROFI -SELECTED_STYLE=$(printf "%s\n" "${STYLES[@]}" | rofi -dmenu -config ~/.config/rofi/config-waybar.rasi "${#STYLES[@]}") +apply_style() { + ln -sf "$CONFIG/$1.css" "$WCONFIG" +} -# Check if rofi is already running -if pidof rofi > /dev/null; then - pkill rofi - exit 0 -fi +main() { + choice=$(menu | rofi -dmenu -config ~/.config/rofi/config-waybar-style.rasi) -# Verify the selected theme -if [[ " ${STYLES[@]} " =~ " $SELECTED_STYLE " ]]; then - SWITCHTO="${SELECTED_STYLE}" -else - echo "Invalid selection" - exit 1 -fi + if [[ -z "$choice" ]]; then + echo "No option selected. Exiting." + exit 0 + fi -# APPLY THEME -THEMEFILE="$HOME/.config/waybar/style/${SWITCHTO}.css" -if [ -f "$THEMEFILE" ]; then - ln -sf "$THEMEFILE" "$HOME/.config/waybar/style.css" -else - echo "Error: $THEMEFILE not found" - exit 1 -fi + apply_style "$choice" -# Restart relevant processes -for process in waybar mako dunst; do - if pidof "$process" > /dev/null; then - pkill "$process" - fi -done + # Restart relevant processes + for process in waybar mako dunst; do + if pgrep -x "$process" >/dev/null; then + pkill "$process" + fi + done + + # Launch Refresh.sh in the background + ~/.config/hypr/scripts/Refresh.sh & +} + +# Check if rofi is already running +if pgrep -x "rofi" >/dev/null; then + pkill rofi + exit 0 +fi -exec ~/.config/hypr/scripts/Refresh.sh +main |
