diff options
Diffstat (limited to 'config/hypr/scripts/Animations.sh')
| -rwxr-xr-x | config/hypr/scripts/Animations.sh | 42 |
1 files changed, 32 insertions, 10 deletions
diff --git a/config/hypr/scripts/Animations.sh b/config/hypr/scripts/Animations.sh index 5fb77750..ae93429b 100755 --- a/config/hypr/scripts/Animations.sh +++ b/config/hypr/scripts/Animations.sh @@ -13,22 +13,44 @@ if pidof rofi > /dev/null; then fi # Variables -iDIR="$HOME/.config/swaync/images" -SCRIPTSDIR="$HOME/.config/hypr/scripts" -animations_dir="$HOME/.config/hypr/animations" -UserConfigs="$HOME/.config/hypr/UserConfigs" -rofi_theme="$HOME/.config/rofi/config-Animations.rasi" -msg='❗NOTE:❗ This will copy animations into UserAnimations.conf' +iDIR="${XDG_CONFIG_HOME:-$HOME/.config}/swaync/images" +SCRIPTSDIR="${XDG_CONFIG_HOME:-$HOME/.config}/hypr/scripts" +animations_dir="${XDG_CONFIG_HOME:-$HOME/.config}/hypr/animations" +UserConfigs="${XDG_CONFIG_HOME:-$HOME/.config}/hypr/UserConfigs" +rofi_theme="${XDG_CONFIG_HOME:-$HOME/.config}/rofi/config-Animations.rasi" +config_home="${XDG_CONFIG_HOME:-$HOME/.config}" +hypr_dir="$config_home/hypr" +lua_entry="$hypr_dir/hyprland.lua" +legacy_lua_entry="$config_home/hyprland.lua" + +# Detect active Hyprland config mode (Lua entrypoint vs legacy .conf includes) +if [[ -f "$lua_entry" || -f "$legacy_lua_entry" ]]; then + hypr_config_mode="lua" + animation_ext="lua" + target_animation_file="$UserConfigs/user_animations.lua" + msg='❗NOTE:❗ This will copy animations into user_animations.lua' +else + hypr_config_mode="conf" + animation_ext="conf" + target_animation_file="$UserConfigs/UserAnimations.conf" + msg='❗NOTE:❗ This will copy animations into UserAnimations.conf' +fi + # list of animation files, sorted alphabetically with numbers first -animations_list=$(find -L "$animations_dir" -maxdepth 1 -type f | sed 's/.*\///' | sed 's/\.conf$//' | sort -V) +animations_list=$(find -L "$animations_dir" -maxdepth 1 -type f -name "*.${animation_ext}" | sed 's/.*\///' | sed "s/\.${animation_ext}$//" | sort -V) + +if [[ -z "$animations_list" ]]; then + notify-send -u normal -i "$iDIR/ja.png" "No animation presets found" "Expected *.${animation_ext} in $animations_dir" + exit 0 +fi # Rofi Menu -chosen_file=$(echo "$animations_list" | rofi -i -dmenu -config $rofi_theme -mesg "$msg") +chosen_file=$(echo "$animations_list" | rofi -i -dmenu -config "$rofi_theme" -mesg "$msg") # Check if a file was selected if [[ -n "$chosen_file" ]]; then - full_path="$animations_dir/$chosen_file.conf" - cp "$full_path" "$UserConfigs/UserAnimations.conf" + full_path="$animations_dir/$chosen_file.$animation_ext" + cp "$full_path" "$target_animation_file" notify-send -u low -i "$iDIR/ja.png" "$chosen_file" "Hyprland Animation Loaded" fi |
