irongit
hygoland/scripts/WaybarStyles.sh
50 lines1.2 KBBourne Again Shell (bash)
1#!/bin/bash
2# /* ---- 💫 https://github.com/JaKooLit 💫 ---- */ ##
3# Script for waybar styles
4
5IFS=$'\n\t'
6
7# Define directories
8waybar_styles="$HOME/.config/waybar/style"
9waybar_style="$HOME/.config/waybar/style.css"
10SCRIPTSDIR="$HOME/.config/hypr/scripts"
11rofi_config="$HOME/.config/rofi/config-waybar-style.rasi"
12msg=' 🎌 NOTE: Some waybar STYLES NOT fully compatible with some LAYOUTS'
13
14# Function to display menu options
15menu() {
16 options=()
17 while IFS= read -r file; do
18 if [ -f "$waybar_styles/$file" ]; then
19 options+=("$(basename "$file" .css)")
20 fi
21 done < <(find -L "$waybar_styles" -maxdepth 1 -type f -name '*.css' -exec basename {} \; | sort )
22
23 printf '%s\n' "${options[@]}"
24}
25
26# Apply selected style
27apply_style() {
28 ln -sf "$waybar_styles/$1.css" "$waybar_style"
29 "${SCRIPTSDIR}/Refresh.sh" &
30}
31
32# Main function
33main() {
34 choice=$(menu | rofi -i -dmenu -config "$rofi_config" -mesg "$msg")
35
36 if [[ -z "$choice" ]]; then
37 echo "No option selected. Exiting."
38 exit 0
39 fi
40
41 apply_style "$choice"
42}
43
44# Kill Rofi if already running before execution
45if pgrep -x "rofi" >/dev/null; then
46 pkill rofi
47 #exit 0
48fi
49
50main