aboutsummaryrefslogtreecommitdiffstats
path: root/config/hypr/scripts/WaybarStyles.sh
blob: 5051fa35916f2c5398eeeb6b00231d34f9647266 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/bin/bash

# ACTUAL THEME
THEMEIS=$(realpath ~/.config/waybar/style.css | sed 's/.*-\(.*\)\.css/\1/')

# Array for the styles
STYLES=(
"pywal" 
"dark" 
"light" 
"Black-&-White" 
"colors" 
"colors-border" 
"colors-line" 
"colorful" 
"catppuccin-mocha" 
"catppuccin-latte"
)

# Build ROFI
SELECTED_STYLE=$(printf "%s\n" "${STYLES[@]}" | rofi -dmenu -config ~/.config/rofi/config-waybar.rasi "${#STYLES[@]}")

# Check if rofi is already running
if pidof rofi > /dev/null; then
  pkill rofi
  exit 0
fi

# Verify the selected theme
if [[ " ${STYLES[@]} " =~ " $SELECTED_STYLE " ]]; then
    SWITCHTO="${SELECTED_STYLE}"
else
    echo "Invalid selection"
    exit 1
fi

# 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 relevant processes
for process in waybar mako dunst; do
    if pidof "$process" > /dev/null; then
        pkill "$process"
    fi
done

exec ~/.config/hypr/scripts/Refresh.sh
send patches to the email below
yukais@pinapelz.com
include the subject [PATCH repo_name]
pinapelz.com
homepage