Skip to content

Commit 26ac697

Browse files
committed
fix(animations): not sourced || wrong sourced path
1 parent 461b3e2 commit 26ac697

File tree

2 files changed

+162
-0
lines changed

2 files changed

+162
-0
lines changed

β€ŽConfigs/.config/hypr/animations.confβ€Ž

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,4 @@
99

1010
$ANIMATION=theme
1111
$ANIMATION_PATH=./animations/theme.conf
12+
source = $ANIMATION_PATH
Lines changed: 161 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,161 @@
1+
#!/usr/bin/env bash
2+
3+
# shellcheck source=$HOME/.local/bin/hyde-shell
4+
# shellcheck disable=SC1091
5+
if ! source "$(which hyde-shell)"; then
6+
echo "[wallbash] code :: Error: hyde-shell not found."
7+
echo "[wallbash] code :: Is HyDE installed?"
8+
exit 1
9+
fi
10+
11+
# Set variables
12+
confDir="${XDG_CONFIG_HOME:-$HOME/.config}"
13+
animations_dir="$confDir/hypr/animations"
14+
15+
# Ensure the animations directory exists
16+
if [ ! -d "$animations_dir" ]; then
17+
notify-send -i "preferences-desktop-display" "Error" "Animations directory does not exist at $animations_dir"
18+
exit 1
19+
fi
20+
21+
# Show help function
22+
show_help() {
23+
cat <<HELP
24+
Usage: $0 [OPTIONS]
25+
26+
Options:
27+
--select | -S Select an animation from the available options
28+
--help | -h Show this help message
29+
HELP
30+
}
31+
32+
if [ -z "${*}" ]; then
33+
echo "No arguments provided"
34+
show_help
35+
fi
36+
37+
# Define long options
38+
LONGOPTS="select,help"
39+
40+
# Parse options
41+
PARSED=$(
42+
if getopt --options Sh --longoptions "${LONGOPTS}" --name "$0" -- "$@"; then
43+
exit 2
44+
fi
45+
)
46+
eval set -- "${PARSED}"
47+
# Default action if no arguments are provided
48+
if [ -z "$1" ]; then
49+
echo "No arguments provided"
50+
show_help
51+
exit 1
52+
fi
53+
54+
# Functions
55+
fn_select() {
56+
animation_items=$(find "$animations_dir" -name "*.conf" ! -name "disable.conf" ! -name "theme.conf" 2>/dev/null | sed 's/\.conf$//')
57+
58+
if [ -z "$animation_items" ]; then
59+
notify-send -i "preferences-desktop-display" "Error" "No .conf files found in $animations_dir"
60+
exit 1
61+
fi
62+
63+
# Set rofi scaling
64+
font_scale="${ROFI_ANIMATION_SCALE}"
65+
[[ "${font_scale}" =~ ^[0-9]+$ ]] || font_scale=${ROFI_SCALE:-10}
66+
67+
# Set font name
68+
font_name=${ROFI_ANIMATION_FONT:-$ROFI_FONT}
69+
font_name=${font_name:-$(get_hyprConf "MENU_FONT")}
70+
font_name=${font_name:-$(get_hyprConf "FONT")}
71+
72+
# Set rofi font override
73+
font_override="* {font: \"${font_name:-"JetBrainsMono Nerd Font"} ${font_scale}\";}"
74+
75+
# Window and element styling
76+
hypr_border=${hypr_border:-"$(hyprctl -j getoption decoration:rounding | jq '.int')"}
77+
wind_border=$((hypr_border * 3 / 2))
78+
elem_border=$((hypr_border == 0 ? 5 : hypr_border))
79+
hypr_width=${hypr_width:-"$(hyprctl -j getoption general:border_size | jq '.int')"}
80+
r_override="window{border:${hypr_width}px;border-radius:${wind_border}px;} wallbox{border-radius:${elem_border}px;} element{border-radius:${elem_border}px;}"
81+
82+
animation_items="Disable Animation
83+
Theme Preference
84+
$animation_items"
85+
rofi_select="${HYPR_ANIMATION/theme/Theme Preference}"
86+
rofi_select="${rofi_select/disable/Disable Animation}"
87+
88+
# Display options using Rofi with custom scaling, positioning, and placeholder
89+
selected_animation=$(awk -F/ '{print $NF}' <<<"$animation_items" |
90+
rofi -dmenu -i -select "$rofi_select" \
91+
-p "Select animation" \
92+
-theme-str "entry { placeholder: \"Select animation...\"; }" \
93+
-theme-str "${font_override}" \
94+
-theme-str "${r_override}" \
95+
-theme-str "$(get_rofi_pos)" \
96+
-theme "clipboard")
97+
98+
# Exit if no selection was made
99+
if [ -z "$selected_animation" ]; then
100+
exit 0
101+
fi
102+
case $selected_animation in
103+
"Disable Animation")
104+
selected_animation="disable"
105+
;;
106+
"Theme Preference")
107+
selected_animation="theme"
108+
;;
109+
esac
110+
111+
set_conf "HYPR_ANIMATION" "$selected_animation"
112+
fn_update
113+
# Notify the user
114+
notify-send -i "preferences-desktop-display" "Animation:" "$selected_animation"
115+
}
116+
117+
fn_update() {
118+
[ -f "$HYDE_STATE_HOME/config" ] && source "$HYDE_STATE_HOME/config"
119+
[ -f "$HYDE_STATE_HOME/staterc" ] && source "$HYDE_STATE_HOME/staterc"
120+
local animDir="$confDir/hypr/animations"
121+
current_animation=${HYPR_ANIMATION:-"theme"}
122+
echo "Animation updated to: $current_animation"
123+
cat <<EOF >"${confDir}/hypr/animations.conf"
124+
125+
#! β–„β–€β–ˆβ€ƒβ–ˆβ–„β–‘β–ˆβ€ƒβ–ˆβ€ƒβ–ˆβ–€β–„β–€β–ˆβ€ƒβ–„β–€β–ˆβ€ƒβ–€β–ˆβ–€β€ƒβ–ˆβ€ƒβ–ˆβ–€β–ˆβ€ƒβ–ˆβ–„β–‘β–ˆ
126+
#! β–ˆβ–€β–ˆβ€ƒβ–ˆβ–‘β–€β–ˆβ€ƒβ–ˆβ€ƒβ–ˆβ–‘β–€β–‘β–ˆβ€ƒβ–ˆβ–€β–ˆβ€ƒβ–‘β–ˆβ–‘β€ƒβ–ˆβ€ƒβ–ˆβ–„β–ˆβ€ƒβ–ˆβ–‘β–€β–ˆ
127+
128+
# See https://wiki.hyprland.org/Configuring/Animations/
129+
# HyDE Controlled content // DO NOT EDIT
130+
# Edit or add animations in the ./hypr/animations/ directory
131+
# and run the 'animations.sh --select' command to update this file
132+
133+
\$ANIMATION=${current_animation}
134+
\$ANIMATION_PATH=./animations/${current_animation}.conf
135+
source = \$ANIMATION_PATH
136+
EOF
137+
# cat "${animDir}/${current_animation}.conf" >>"${confDir}/hypr/animations.conf"
138+
}
139+
140+
# Process options
141+
while true; do
142+
case "$1" in
143+
-S | --select)
144+
fn_select
145+
exit 0
146+
;;
147+
--help | -h)
148+
show_help
149+
exit 0
150+
;;
151+
--)
152+
shift
153+
break
154+
;;
155+
*)
156+
echo "Invalid option: $1"
157+
show_help
158+
exit 1
159+
;;
160+
esac
161+
done

0 commit comments

Comments
Β (0)