diff --git a/README.md b/README.md index a3f6a28..6a9cc29 100644 --- a/README.md +++ b/README.md @@ -38,6 +38,32 @@ On the other machine: `git pull && ./apply.sh`. Only files that already exist in `config/` are collected/applied, so nothing gets tracked by accident. +## Hyprimate (window animation plugin) + +The burger-menu animation picker also offers **Hyprimate** styles (Liquid, Paper, +Cloth, Swarm, Bubble, Smoke, Burn, Construction) — a Hyprland plugin that animates +windows as they open, move and close. + +Tracked here: + +- `config/hypr/lua/animations/hyprimate-*.lua` — one menu item per style (user layer). +- `config/hyde/scripts/hyprimate-guard.sh` — auto-loads the plugin when a hyprimate + style is current and switches it off when a native animation is selected. + Hooked into `hyprland.lua` via `hl.exec_cmd`. +- `config/hyde/scripts/rebuild-hyprimate.sh` — rebuild after a Hyprland update. + +Setup on a new machine (the plugin binary itself is NOT tracked): + +```bash +git clone --depth 1 https://github.com/JustinBacher/hyprimate ~/.local/src/hyprimate +cmake -B ~/.local/src/hyprimate/build -S ~/.local/src/hyprimate -G Ninja && ninja -C ~/.local/src/hyprimate/build +hyprctl plugin load ~/.local/src/hyprimate/build/hyprimate.so +``` + +Then pick a Hyprimate style in the animation menu; the guard handles loading on +future boots. Note: hyprpm is an alternative installer, but it needs sudo for its +state store in `/var/cache/hyprpm/`; the manual build above avoids that. + ## Notes - `hypr/hyprland.lua` is loaded by HyDE last as the override layer. See the diff --git a/config/hyde/scripts/hyprimate-guard.sh b/config/hyde/scripts/hyprimate-guard.sh old mode 100644 new mode 100755 index e69de29..b1537f6 --- a/config/hyde/scripts/hyprimate-guard.sh +++ b/config/hyde/scripts/hyprimate-guard.sh @@ -0,0 +1,36 @@ +#!/usr/bin/env bash +# Hyprimate guard — keep the hyprimate plugin off unless a hyprimate-* animation +# is the current HyDE animation selection. +# +# HyDE's own animation items (classic, macos, ...) know nothing about the +# plugin, so after switching back to a native animation hyprimate would keep +# hijacking window open/close/movement. This script is invoked via hl.exec_cmd +# from ~/.config/hypr/hyprland.lua on every config load. +# +# It MUST stay a separate process: calling hyprctl from inside Lua config +# evaluation deadlocks the compositor (the IPC loop is busy loading the config). +set -u + +SO="$HOME/.local/src/hyprimate/build/hyprimate.so" +staterc="${XDG_STATE_HOME:-$HOME/.local/state}/hyde/staterc" +key=$(sed -n 's/^HYPR_ANIMATION="\{0,1\}\([^"]*\)"\{0,1\}$/\1/p' "$staterc" 2>/dev/null | tail -1) + +# A hyprimate-* animation is selected: ensure the plugin is loaded. On cold +# boot the animation item file sets plugin:* keys before the plugin exists, so +# after loading we do one clean config-only reload: it clears the unknown-key +# error banner and re-applies the style settings from the item file. +if [[ "$key" == hyprimate* ]]; then + [[ -f "$SO" ]] || exit 0 + if ! hyprctl plugins list 2>/dev/null | grep -q hyprimate; then + hyprctl plugin load "$SO" >/dev/null 2>&1 || exit 0 + hyprctl reload config-only >/dev/null 2>&1 + fi + exit 0 +fi + +# Plugin not loaded: touching plugin:hyprimate keys would raise unknown-key +# errors, so nothing to do. +hyprctl plugins list 2>/dev/null | grep -q hyprimate || exit 0 + +# Native animation is current and hyprimate is loaded: switch its effects off. +hyprctl repl "hl.config{plugin={hyprimate={window={enabled=false},workspace={enabled=false}}}}" >/dev/null 2>&1 diff --git a/config/hyde/scripts/rebuild-hyprimate.sh b/config/hyde/scripts/rebuild-hyprimate.sh old mode 100644 new mode 100755 index e69de29..bdeb43a --- a/config/hyde/scripts/rebuild-hyprimate.sh +++ b/config/hyde/scripts/rebuild-hyprimate.sh @@ -0,0 +1,15 @@ +#!/usr/bin/env bash +# Rebuild hyprimate after a Hyprland update (plugins are ABI-locked to the +# compositor version). Run this in a terminal after `pacman -Syu` bumps +# hyprland, then restart Hyprland if the plugin was loaded. +set -eu +cd "$HOME/.local/src/hyprimate" +git pull --ff-only +cmake -B build -G Ninja +ninja -C build +# hot-swap if loaded +if hyprctl plugins list 2>/dev/null | grep -q hyprimate; then + hyprctl plugin unload "$PWD/build/hyprimate.so" >/dev/null 2>&1 || true + hyprctl plugin load "$PWD/build/hyprimate.so" >/dev/null 2>&1 || true +fi +echo "hyprimate rebuilt: $(ls -la build/hyprimate.so)" diff --git a/config/hypr/hyprland.lua b/config/hypr/hyprland.lua index 80f21d8..71d8b39 100644 --- a/config/hypr/hyprland.lua +++ b/config/hypr/hyprland.lua @@ -124,3 +124,11 @@ hl.window_rule({ match = { class = "^(chrome-chat.obahan.xyz__-Default)$" }, opacity = "0.9 override 0.9 override 1.0 override", }) + +-- // Hyprimate guard +-- The hyprimate-* animation items in ~/.config/hypr/lua/animations/ enable the +-- plugin themselves, but HyDE's native animation items know nothing about it. +-- This runs a small script on every config load that switches hyprimate back +-- off when a native animation is current. It must stay a separate process: +-- calling hyprctl from inside Lua config evaluation deadlocks the compositor. +hl.exec_cmd("/home/lucas/.config/hyde/scripts/hyprimate-guard.sh") diff --git a/config/hypr/lua/animations/hyprimate-bubble.lua b/config/hypr/lua/animations/hyprimate-bubble.lua index e69de29..db797ca 100644 --- a/config/hypr/lua/animations/hyprimate-bubble.lua +++ b/config/hypr/lua/animations/hyprimate-bubble.lua @@ -0,0 +1,31 @@ +-- Hyprimate · Bubble — plugin-driven window animation. +-- User-layer animation item: picked from the HyDE burger-menu / SUPER+SHIFT+Y. +-- Requires the hyprimate plugin (hyprpm). The file is inert for the menu scan +-- (no `hl`); it only applies settings when HyDE loads it as the current +-- animation. The hyprimate guard in ~/.config/hypr/hyprland.lua switches the +-- plugin off again when a native animation is selected. + +local animation = { + name = "Hyprimate · Bubble", + icon = "󰟠", + description = "Hyprimate: windows inflate a soap film, slosh and burst." +} + +if not hl then + return animation +end + +hl.config({ + decoration = { wobble = { enabled = false } }, + plugin = { + ["hyprimate"] = { + window = { + enabled = true, + style = "bubble", + open = { enabled = true }, + close = { enabled = true }, + movement = { enabled = true }, + }, + }, + }, +}) diff --git a/config/hypr/lua/animations/hyprimate-burn.lua b/config/hypr/lua/animations/hyprimate-burn.lua index e69de29..6d1d250 100644 --- a/config/hypr/lua/animations/hyprimate-burn.lua +++ b/config/hypr/lua/animations/hyprimate-burn.lua @@ -0,0 +1,31 @@ +-- Hyprimate · Burn — plugin-driven window animation. +-- User-layer animation item: picked from the HyDE burger-menu / SUPER+SHIFT+Y. +-- Requires the hyprimate plugin (hyprpm). The file is inert for the menu scan +-- (no `hl`); it only applies settings when HyDE loads it as the current +-- animation. The hyprimate guard in ~/.config/hypr/hyprland.lua switches the +-- plugin off again when a native animation is selected. + +local animation = { + name = "Hyprimate · Burn", + icon = "󰇎", + description = "Hyprimate: windows burn in with embers and scorch out." +} + +if not hl then + return animation +end + +hl.config({ + decoration = { wobble = { enabled = false } }, + plugin = { + ["hyprimate"] = { + window = { + enabled = true, + style = "burn", + open = { enabled = true }, + close = { enabled = true }, + movement = { enabled = true }, + }, + }, + }, +}) diff --git a/config/hypr/lua/animations/hyprimate-cloth.lua b/config/hypr/lua/animations/hyprimate-cloth.lua index e69de29..3a232f3 100644 --- a/config/hypr/lua/animations/hyprimate-cloth.lua +++ b/config/hypr/lua/animations/hyprimate-cloth.lua @@ -0,0 +1,31 @@ +-- Hyprimate · Cloth — plugin-driven window animation. +-- User-layer animation item: picked from the HyDE burger-menu / SUPER+SHIFT+Y. +-- Requires the hyprimate plugin (hyprpm). The file is inert for the menu scan +-- (no `hl`); it only applies settings when HyDE loads it as the current +-- animation. The hyprimate guard in ~/.config/hypr/hyprland.lua switches the +-- plugin off again when a native animation is selected. + +local animation = { + name = "Hyprimate · Cloth", + icon = "󰇆", + description = "Hyprimate: windows drape and fold like a curtain." +} + +if not hl then + return animation +end + +hl.config({ + decoration = { wobble = { enabled = false } }, + plugin = { + ["hyprimate"] = { + window = { + enabled = true, + style = "cloth", + open = { enabled = true }, + close = { enabled = true }, + movement = { enabled = true }, + }, + }, + }, +}) diff --git a/config/hypr/lua/animations/hyprimate-construction.lua b/config/hypr/lua/animations/hyprimate-construction.lua index e69de29..59cbb08 100644 --- a/config/hypr/lua/animations/hyprimate-construction.lua +++ b/config/hypr/lua/animations/hyprimate-construction.lua @@ -0,0 +1,31 @@ +-- Hyprimate · Construction — plugin-driven window animation. +-- User-layer animation item: picked from the HyDE burger-menu / SUPER+SHIFT+Y. +-- Requires the hyprimate plugin (hyprpm). The file is inert for the menu scan +-- (no `hl`); it only applies settings when HyDE loads it as the current +-- animation. The hyprimate guard in ~/.config/hypr/hyprland.lua switches the +-- plugin off again when a native animation is selected. + +local animation = { + name = "Hyprimate · Construction", + icon = "󰞏", + description = "Hyprimate: miniature workers build and implode the window." +} + +if not hl then + return animation +end + +hl.config({ + decoration = { wobble = { enabled = false } }, + plugin = { + ["hyprimate"] = { + window = { + enabled = true, + style = "construction", + open = { enabled = true }, + close = { enabled = true }, + movement = { enabled = true }, + }, + }, + }, +}) diff --git a/config/hypr/lua/animations/hyprimate-liquid.lua b/config/hypr/lua/animations/hyprimate-liquid.lua index e69de29..638aac3 100644 --- a/config/hypr/lua/animations/hyprimate-liquid.lua +++ b/config/hypr/lua/animations/hyprimate-liquid.lua @@ -0,0 +1,31 @@ +-- Hyprimate · Liquid — plugin-driven window animation. +-- User-layer animation item: picked from the HyDE burger-menu / SUPER+SHIFT+Y. +-- Requires the hyprimate plugin (hyprpm). The file is inert for the menu scan +-- (no `hl`); it only applies settings when HyDE loads it as the current +-- animation. The hyprimate guard in ~/.config/hypr/hyprland.lua switches the +-- plugin off again when a native animation is selected. + +local animation = { + name = "Hyprimate · Liquid", + icon = "󰏡", + description = "Hyprimate: windows flow and stretch like liquid." +} + +if not hl then + return animation +end + +hl.config({ + decoration = { wobble = { enabled = false } }, + plugin = { + ["hyprimate"] = { + window = { + enabled = true, + style = "liquid", + open = { enabled = true }, + close = { enabled = true }, + movement = { enabled = true }, + }, + }, + }, +}) diff --git a/config/hypr/lua/animations/hyprimate-paper.lua b/config/hypr/lua/animations/hyprimate-paper.lua index e69de29..a85ecfb 100644 --- a/config/hypr/lua/animations/hyprimate-paper.lua +++ b/config/hypr/lua/animations/hyprimate-paper.lua @@ -0,0 +1,31 @@ +-- Hyprimate · Paper — plugin-driven window animation. +-- User-layer animation item: picked from the HyDE burger-menu / SUPER+SHIFT+Y. +-- Requires the hyprimate plugin (hyprpm). The file is inert for the menu scan +-- (no `hl`); it only applies settings when HyDE loads it as the current +-- animation. The hyprimate guard in ~/.config/hypr/hyprland.lua switches the +-- plugin off again when a native animation is selected. + +local animation = { + name = "Hyprimate · Paper", + icon = "󰈙", + description = "Hyprimate: windows crumple and unfold like paper." +} + +if not hl then + return animation +end + +hl.config({ + decoration = { wobble = { enabled = false } }, + plugin = { + ["hyprimate"] = { + window = { + enabled = true, + style = "paper", + open = { enabled = true }, + close = { enabled = true }, + movement = { enabled = true }, + }, + }, + }, +}) diff --git a/config/hypr/lua/animations/hyprimate-smoke.lua b/config/hypr/lua/animations/hyprimate-smoke.lua index e69de29..a7864ec 100644 --- a/config/hypr/lua/animations/hyprimate-smoke.lua +++ b/config/hypr/lua/animations/hyprimate-smoke.lua @@ -0,0 +1,31 @@ +-- Hyprimate · Smoke — plugin-driven window animation. +-- User-layer animation item: picked from the HyDE burger-menu / SUPER+SHIFT+Y. +-- Requires the hyprimate plugin (hyprpm). The file is inert for the menu scan +-- (no `hl`); it only applies settings when HyDE loads it as the current +-- animation. The hyprimate guard in ~/.config/hypr/hyprland.lua switches the +-- plugin off again when a native animation is selected. + +local animation = { + name = "Hyprimate · Smoke", + icon = "󰸆", + description = "Hyprimate: windows unravel into smoke and reform." +} + +if not hl then + return animation +end + +hl.config({ + decoration = { wobble = { enabled = false } }, + plugin = { + ["hyprimate"] = { + window = { + enabled = true, + style = "smoke", + open = { enabled = true }, + close = { enabled = true }, + movement = { enabled = true }, + }, + }, + }, +}) diff --git a/config/hypr/lua/animations/hyprimate-swarm.lua b/config/hypr/lua/animations/hyprimate-swarm.lua index e69de29..5caae74 100644 --- a/config/hypr/lua/animations/hyprimate-swarm.lua +++ b/config/hypr/lua/animations/hyprimate-swarm.lua @@ -0,0 +1,31 @@ +-- Hyprimate · Swarm — plugin-driven window animation. +-- User-layer animation item: picked from the HyDE burger-menu / SUPER+SHIFT+Y. +-- Requires the hyprimate plugin (hyprpm). The file is inert for the menu scan +-- (no `hl`); it only applies settings when HyDE loads it as the current +-- animation. The hyprimate guard in ~/.config/hypr/hyprland.lua switches the +-- plugin off again when a native animation is selected. + +local animation = { + name = "Hyprimate · Swarm", + icon = "󰒙", + description = "Hyprimate: windows scatter into creatures and regroup." +} + +if not hl then + return animation +end + +hl.config({ + decoration = { wobble = { enabled = false } }, + plugin = { + ["hyprimate"] = { + window = { + enabled = true, + style = "swarm", + open = { enabled = true }, + close = { enabled = true }, + movement = { enabled = true }, + }, + }, + }, +})