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