Fix: Rewrite animation picker to switch Lua presets
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,34 +1,6 @@
|
|||||||
-- HyprFlux — https://github.com/ahmad9059/HyprFlux
|
-- Active animation preset.
|
||||||
-- Ported from UserConfigs/UserAnimations.conf (the active preset)
|
-- The presets live in ../presets/anim-*.lua. Super+Shift+A (scripts/Animations.sh)
|
||||||
--
|
-- picks one and rewrites the require() line below; edit it by hand to switch too,
|
||||||
-- The 14 alternative presets from animations/*.conf were also ported, flat, as
|
-- e.g. require("presets.anim-ml4w-classic"). Keep it to this single line.
|
||||||
-- anim-*.lua (see the plan) — none of them are wired in. They now live in ../presets/.
|
|
||||||
-- To switch styles, replace the body of this file with `require("presets.anim-<preset>")`,
|
|
||||||
-- e.g. require("presets.anim-ml4w-classic").
|
|
||||||
|
|
||||||
hl.config({
|
require("presets.anim-hyprflux")
|
||||||
animations = {
|
|
||||||
enabled = true,
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
hl.curve("wind", { type = "bezier", points = { { 0.05, 0.9 }, { 0.1, 1.05 } } })
|
|
||||||
hl.curve("winIn", { type = "bezier", points = { { 0.1, 1.1 }, { 0.1, 1.1 } } })
|
|
||||||
hl.curve("winOut", { type = "bezier", points = { { 0.3, -0.3 }, { 0, 1 } } })
|
|
||||||
hl.curve("liner", { type = "bezier", points = { { 1, 1 }, { 1, 1 } } })
|
|
||||||
hl.curve("overshot", { type = "bezier", points = { { 0.05, 0.9 }, { 0.1, 1.05 } } })
|
|
||||||
hl.curve("smoothOut", { type = "bezier", points = { { 0.5, 0 }, { 0.99, 0.99 } } })
|
|
||||||
hl.curve("smoothIn", { type = "bezier", points = { { 0.5, -0.5 }, { 0.68, 1.5 } } })
|
|
||||||
|
|
||||||
hl.animation({ leaf = "windows", enabled = true, speed = 6, bezier = "wind", style = "slide" })
|
|
||||||
hl.animation({ leaf = "windowsIn", enabled = true, speed = 5, bezier = "winIn", style = "slide" })
|
|
||||||
hl.animation({ leaf = "windowsOut", enabled = true, speed = 3, bezier = "smoothOut", style = "slide" })
|
|
||||||
hl.animation({ leaf = "windowsMove", enabled = true, speed = 5, bezier = "wind", style = "slide" })
|
|
||||||
hl.animation({ leaf = "border", enabled = true, speed = 1, bezier = "liner" })
|
|
||||||
hl.animation({ leaf = "borderangle", enabled = true, speed = 100, bezier = "liner", style = "loop" }) -- used by rainbow borders and rotating colors; speed clamped from 180 -> Lua hl.animation caps speed at 100
|
|
||||||
hl.animation({ leaf = "fade", enabled = true, speed = 3, bezier = "smoothOut" })
|
|
||||||
hl.animation({ leaf = "workspaces", enabled = true, speed = 5, bezier = "overshot" })
|
|
||||||
|
|
||||||
-- animations for -git or version >0.42.0
|
|
||||||
hl.animation({ leaf = "workspacesIn", enabled = true, speed = 5, bezier = "winIn", style = "slide" })
|
|
||||||
hl.animation({ leaf = "workspacesOut", enabled = true, speed = 5, bezier = "winOut", style = "slide" })
|
|
||||||
|
|||||||
31
dotfiles/.config/hypr/presets/anim-hyprflux.lua
Normal file
31
dotfiles/.config/hypr/presets/anim-hyprflux.lua
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
-- HyprFlux — https://github.com/ahmad9059/HyprFlux
|
||||||
|
-- name "HyprFlux (default)"
|
||||||
|
-- The animation set that shipped as appearance/animations.lua (ported from
|
||||||
|
-- UserConfigs/UserAnimations.conf). Selected by default; Super+Shift+A switches.
|
||||||
|
|
||||||
|
hl.config({
|
||||||
|
animations = {
|
||||||
|
enabled = true,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
hl.curve("wind", { type = "bezier", points = { { 0.05, 0.9 }, { 0.1, 1.05 } } })
|
||||||
|
hl.curve("winIn", { type = "bezier", points = { { 0.1, 1.1 }, { 0.1, 1.1 } } })
|
||||||
|
hl.curve("winOut", { type = "bezier", points = { { 0.3, -0.3 }, { 0, 1 } } })
|
||||||
|
hl.curve("liner", { type = "bezier", points = { { 1, 1 }, { 1, 1 } } })
|
||||||
|
hl.curve("overshot", { type = "bezier", points = { { 0.05, 0.9 }, { 0.1, 1.05 } } })
|
||||||
|
hl.curve("smoothOut", { type = "bezier", points = { { 0.5, 0 }, { 0.99, 0.99 } } })
|
||||||
|
hl.curve("smoothIn", { type = "bezier", points = { { 0.5, -0.5 }, { 0.68, 1.5 } } })
|
||||||
|
|
||||||
|
hl.animation({ leaf = "windows", enabled = true, speed = 6, bezier = "wind", style = "slide" })
|
||||||
|
hl.animation({ leaf = "windowsIn", enabled = true, speed = 5, bezier = "winIn", style = "slide" })
|
||||||
|
hl.animation({ leaf = "windowsOut", enabled = true, speed = 3, bezier = "smoothOut", style = "slide" })
|
||||||
|
hl.animation({ leaf = "windowsMove", enabled = true, speed = 5, bezier = "wind", style = "slide" })
|
||||||
|
hl.animation({ leaf = "border", enabled = true, speed = 1, bezier = "liner" })
|
||||||
|
hl.animation({ leaf = "borderangle", enabled = true, speed = 100, bezier = "liner", style = "loop" }) -- used by rainbow borders and rotating colors; speed clamped from 180 -> Lua hl.animation caps speed at 100
|
||||||
|
hl.animation({ leaf = "fade", enabled = true, speed = 3, bezier = "smoothOut" })
|
||||||
|
hl.animation({ leaf = "workspaces", enabled = true, speed = 5, bezier = "overshot" })
|
||||||
|
|
||||||
|
-- animations for -git or version >0.42.0
|
||||||
|
hl.animation({ leaf = "workspacesIn", enabled = true, speed = 5, bezier = "winIn", style = "slide" })
|
||||||
|
hl.animation({ leaf = "workspacesOut", enabled = true, speed = 5, bezier = "winOut", style = "slide" })
|
||||||
@@ -1,31 +1,38 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# HyprFlux — https://github.com/ahmad9059/HyprFlux
|
# Animation preset picker (Super+Shift+A).
|
||||||
# For applying Animations from different users
|
# Lists ~/.config/hypr/presets/anim-*.lua by their original HyprFlux preset name
|
||||||
|
# (the "Ported from animations/<name>.conf" line, else `-- name "..."`), then
|
||||||
|
# points appearance/animations.lua's require() at the chosen one and reloads.
|
||||||
|
|
||||||
|
iDIR="$HOME/.config/swaync/images"
|
||||||
|
presets_dir="$HOME/.config/hypr/presets"
|
||||||
|
active_file="$HOME/.config/hypr/appearance/animations.lua"
|
||||||
|
rofi_theme="$HOME/.config/rofi/launchers/type-4/style-4.rasi"
|
||||||
|
|
||||||
# Check if rofi is already running
|
|
||||||
if pidof rofi >/dev/null; then
|
if pidof rofi >/dev/null; then
|
||||||
pkill rofi
|
pkill rofi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Variables
|
# "Display name<TAB>module" per preset, sorted by name
|
||||||
iDIR="$HOME/.config/swaync/images"
|
list=$(for f in "$presets_dir"/anim-*.lua; do
|
||||||
SCRIPTSDIR="$HOME/.config/hypr/scripts"
|
module=$(basename "$f" .lua)
|
||||||
animations_dir="$HOME/.config/hypr/animations"
|
name=$(sed -n 's/^-- Ported from animations\/\(.*\)\.conf.*/\1/p' "$f" | head -n1)
|
||||||
UserConfigs="$HOME/.config/hypr/UserConfigs"
|
[[ -z "$name" ]] && name=$(sed -n 's/^-- name "\(.*\)"$/\1/p' "$f" | head -n1)
|
||||||
rofi_theme="$HOME/.config/rofi/config-Animations.rasi"
|
printf '%s\t%s\n' "${name:-$module}" "$module"
|
||||||
msg='❗NOTE:❗ This will copy animations into UserAnimations.conf'
|
done | sort -f)
|
||||||
# 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)
|
|
||||||
|
|
||||||
# Rofi Menu
|
current=$(sed -n 's/^require("presets\.\(.*\)")$/\1/p' "$active_file")
|
||||||
chosen_file=$(echo "$animations_list" | rofi -i -dmenu -config $rofi_theme -mesg "$msg")
|
current_name=$(awk -F'\t' -v m="$current" '$2 == m { print $1 }' <<<"$list")
|
||||||
|
|
||||||
# Check if a file was selected
|
chosen=$(cut -f1 <<<"$list" | rofi -i -dmenu -p "Animations" \
|
||||||
if [[ -n "$chosen_file" ]]; then
|
-theme "$rofi_theme" \
|
||||||
full_path="$animations_dir/$chosen_file.conf"
|
-theme-str 'mainbox { children: [ "inputbar", "message", "listview" ]; }' \
|
||||||
cp "$full_path" "$UserConfigs/UserAnimations.conf"
|
-mesg "Current: ${current_name:-$current}")
|
||||||
notify-send -u low -i "$iDIR/ja.png" "$chosen_file" "Hyprland Animation Loaded"
|
[[ -z "$chosen" ]] && exit 0
|
||||||
fi
|
|
||||||
|
|
||||||
sleep 1
|
module=$(awk -F'\t' -v n="$chosen" '$1 == n { print $2; exit }' <<<"$list")
|
||||||
"$SCRIPTSDIR/RefreshNoWaybar.sh"
|
[[ -z "$module" ]] && exit 1
|
||||||
|
|
||||||
|
sed -i "s/^require(\"presets\.[^\"]*\")$/require(\"presets.$module\")/" "$active_file"
|
||||||
|
hyprctl reload >/dev/null
|
||||||
|
notify-send -u low -i "$iDIR/note.png" "$chosen" "Hyprland animation loaded"
|
||||||
|
|||||||
Reference in New Issue
Block a user