30 changed files with 547 additions and 85 deletions
@ -1,58 +1,49 @@ |
|||||||
#!/bin/bash |
#!/bin/bash |
||||||
|
|
||||||
# ACTUAL THEME |
CONFIG="$HOME/.config/waybar/style" |
||||||
THEMEIS=$(realpath ~/.config/waybar/style.css | sed 's/.*-\(.*\)\.css/\1/') |
WCONFIG="$HOME/.config/waybar/style.css" |
||||||
|
|
||||||
# Array for the styles |
menu() { |
||||||
STYLES=( |
# List only files (excluding directories) in the directory and sort alphabetically |
||||||
"Purpl" |
options=() |
||||||
"Crimson" |
while IFS= read -r file; do |
||||||
"Golden-Noir" |
if [ -f "$CONFIG/$file" ]; then |
||||||
"Simple-Pink" |
options+=("$(basename "$file" .css)") |
||||||
"pywal" |
|
||||||
"dark" |
|
||||||
"light" |
|
||||||
"Black-&-White" |
|
||||||
"colors" |
|
||||||
"colors-border" |
|
||||||
"colors-line" |
|
||||||
"colorful" |
|
||||||
"Catppuccin-Mocha" |
|
||||||
"Catppuccin-Latte" |
|
||||||
"Transparent" |
|
||||||
) |
|
||||||
|
|
||||||
# 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 |
fi |
||||||
|
done < <(find "$CONFIG" -maxdepth 1 -type f -name '*.css' -exec basename {} \; | sort) |
||||||
|
|
||||||
# Verify the selected theme |
printf '%s\n' "${options[@]}" |
||||||
if [[ " ${STYLES[@]} " =~ " $SELECTED_STYLE " ]]; then |
} |
||||||
SWITCHTO="${SELECTED_STYLE}" |
|
||||||
else |
apply_style() { |
||||||
echo "Invalid selection" |
ln -sf "$CONFIG/$1.css" "$WCONFIG" |
||||||
exit 1 |
} |
||||||
fi |
|
||||||
|
|
||||||
# APPLY THEME |
main() { |
||||||
THEMEFILE="$HOME/.config/waybar/style/${SWITCHTO}.css" |
choice=$(menu | rofi -dmenu -config ~/.config/rofi/config-waybar-style.rasi) |
||||||
if [ -f "$THEMEFILE" ]; then |
|
||||||
ln -sf "$THEMEFILE" "$HOME/.config/waybar/style.css" |
if [[ -z "$choice" ]]; then |
||||||
else |
echo "No option selected. Exiting." |
||||||
echo "Error: $THEMEFILE not found" |
exit 0 |
||||||
exit 1 |
|
||||||
fi |
fi |
||||||
|
|
||||||
|
apply_style "$choice" |
||||||
|
|
||||||
# Restart relevant processes |
# Restart relevant processes |
||||||
for process in waybar mako dunst; do |
for process in waybar mako dunst; do |
||||||
if pidof "$process" > /dev/null; then |
if pgrep -x "$process" >/dev/null; then |
||||||
pkill "$process" |
pkill "$process" |
||||||
fi |
fi |
||||||
done |
done |
||||||
|
|
||||||
exec ~/.config/hypr/scripts/Refresh.sh |
# 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 |
||||||
|
|
||||||
|
main |
||||||
|
|||||||
Loading…
Reference in new issue