aboutsummaryrefslogtreecommitdiffstats
path: root/config/hypr/UserScripts
diff options
context:
space:
mode:
authorDon Williams <don.e.williams@gmail.com>2026-02-23 18:47:47 -0500
committerDon Williams <don.e.williams@gmail.com>2026-02-23 18:47:47 -0500
commit59e87cbf4482efb6d7c8ff766f80b0286a20732b (patch)
tree7b2bdf7ae6c399a54e154896b78dfef9ec0dd2b7 /config/hypr/UserScripts
parentc8767dfaa8c9efbeeec0293ffe4287a40c02b34c (diff)
parentc1ae43efc9196eca55c59cc43dd8f85975d84206 (diff)
Merge branch 'development'
Conflicts: README.md config/fastfetch/config-compact.jsonc config/fastfetch/config.jsonc config/hypr/scripts/Tak0-Per-Window-Switch.sh i18n/README/README.de.md i18n/README/README.jp.md i18n/README/README.ro.md i18n/README/README.ru.md i18n/README/README.ua.md It looks like you may be committing a merge. If this is not correct, please run git update-ref -d MERGE_HEAD and try again. Please enter the commit message for your changes. Lines starting with '#' will be ignored, and an empty message aborts the commit. On branch main Your branch is up to date with 'origin/main'. All conflicts fixed but you are still merging. Changes to be committed: modified: CHANGELOG.md modified: README.md renamed: update-dots.sh -> archive/update-dots.sh new file: assets/waybar-weather.gz new file: config/fastfetch/config-compact-legacy.jsonc modified: config/fastfetch/config-compact.jsonc modified: config/fastfetch/config.jsonc new file: config/fastfetch/config.legacy.jsonc modified: config/hypr/UserConfigs/WindowRules.conf new file: config/hypr/UserScripts/RainbowBorders-low-cpu.sh modified: config/hypr/configs/ENVariables.conf modified: config/hypr/configs/Keybinds.conf modified: config/hypr/configs/Startup_Apps.conf modified: config/hypr/configs/WindowRules-config-v3.conf modified: config/hypr/configs/WindowRules.conf modified: config/hypr/monitors.conf modified: config/hypr/scripts/Kitty_themes.sh modified: config/hypr/scripts/Kool_Quick_Settings.sh new file: config/hypr/scripts/PortalHyprlandUbuntu2604.sh modified: config/hypr/scripts/Refresh.sh modified: config/hypr/scripts/Tak0-Per-Window-Switch.sh new file: config/hypr/scripts/Toggle-Active-Window-Audio.sh new file: config/hypr/scripts/Toggle-weather-waybar-units.sh modified: config/hypr/scripts/WallustSwww.sh modified: config/hypr/scripts/WaybarCava.sh new file: config/hypr/scripts/dots-tui new file: config/hypr/scripts/dots-tui-ubuntu-2404 new file: config/hypr/scripts/hyprshot.sh new file: config/hypr/scripts/install-uv.sh renamed: config/hypr/v2.3.20 -> config/hypr/v2.3.21 modified: config/hypr/wallpaper_effects/.wallpaper_current modified: config/kitty/kitty.conf new file: config/rofi/00-terminal.rasi modified: config/rofi/config.rasi modified: config/wallust/templates/colors-waybar.css new file: config/wallust/wallust-kitty.toml modified: config/wallust/wallust.toml new file: config/waybar-weather/cityname.txt new file: config/waybar-weather/config.toml new file: config/waybar-weather/geolocation.txt modified: config/waybar/ModulesCustom modified: config/waybar/config renamed: config/waybar/configs/[BOT & Left] SouthWest -> config/waybar/configs/BOT-&-Left-SouthWest renamed: config/waybar/configs/[BOT & Right] SouthEast -> config/waybar/configs/BOT-&-Right-SouthEast renamed: config/waybar/configs/[BOT] Camellia -> config/waybar/configs/BOT-Camellia renamed: config/waybar/configs/[BOT] Chrysanthemum -> config/waybar/configs/BOT-Chrysanthemum renamed: config/waybar/configs/[BOT] Default -> config/waybar/configs/BOT-Default renamed: config/waybar/configs/[BOT] Default Laptop -> config/waybar/configs/BOT-Default-Laptop renamed: config/waybar/configs/[BOT] Gardenia -> config/waybar/configs/BOT-Gardenia renamed: config/waybar/configs/[BOT] Peony -> config/waybar/configs/BOT-Peony renamed: config/waybar/configs/[BOT] Simple -> config/waybar/configs/BOT-Simple renamed: config/waybar/configs/[BOT] Sleek -> config/waybar/configs/BOT-Sleek renamed: config/waybar/configs/[LEFT] WestWing -> config/waybar/configs/LEFT-WestWing renamed: config/waybar/configs/[LEFT] WestWing v2 -> config/waybar/configs/LEFT-WestWing-v2 renamed: config/waybar/configs/[RIGHT] EastWing -> config/waybar/configs/RIGHT-EastWing renamed: config/waybar/configs/[RIGHT] EastWing v2 -> config/waybar/configs/RIGHT-EastWing-v2 renamed: config/waybar/configs/[TOP & BOT] SummitSplit -> config/waybar/configs/TOP-&-BOT-SummitSplit renamed: config/waybar/configs/[TOP & BOT] SummitSplit-glass -> config/waybar/configs/TOP-&-BOT-SummitSplit-glass renamed: config/waybar/configs/[TOP & BOT] SummitSplit v2 -> config/waybar/configs/TOP-&-BOT-SummitSplit-v2 new file: config/waybar/configs/TOP-&-BOT-SummitSplit-v3 renamed: config/waybar/configs/[TOP & Left] NorthWest -> config/waybar/configs/TOP-&-Left-NorthWest renamed: config/waybar/configs/[TOP & Right] NorthEast -> config/waybar/configs/TOP-&-Right-NorthEast renamed: config/waybar/configs/[TOP] 0-Ja-0 -> config/waybar/configs/TOP-0-Ja-0 renamed: config/waybar/configs/[TOP] Arrow -> config/waybar/configs/TOP-Arrow renamed: config/waybar/configs/[TOP] Camellia -> config/waybar/configs/TOP-Camellia renamed: config/waybar/configs/[TOP] Chrysanthemum -> config/waybar/configs/TOP-Chrysanthemum renamed: config/waybar/configs/[TOP] Default -> config/waybar/configs/TOP-Default renamed: config/waybar/configs/[TOP] Default Laptop -> config/waybar/configs/TOP-Default-Laptop renamed: config/waybar/configs/[TOP] Default Laptop-glass -> config/waybar/configs/TOP-Default-Laptop-glass renamed: config/waybar/configs/[TOP] Default Laptop (old v1) -> config/waybar/configs/TOP-Default-Laptop-old-v1 renamed: config/waybar/configs/[TOP] Default Laptop (old v2) -> config/waybar/configs/TOP-Default-Laptop-old-v2 renamed: config/waybar/configs/[TOP] Default Laptop (old v3) -> config/waybar/configs/TOP-Default-Laptop-old-v3 renamed: config/waybar/configs/[TOP] Default Laptop (old v4) -> config/waybar/configs/TOP-Default-Laptop-old-v4 renamed: config/waybar/configs/[TOP] Default Laptop (old v5) -> config/waybar/configs/TOP-Default-Laptop-old-v5 renamed: config/waybar/configs/[TOP] Default (old v1) -> config/waybar/configs/TOP-Default-old-v1 renamed: config/waybar/configs/[TOP] Default (old v2) -> config/waybar/configs/TOP-Default-old-v2 renamed: config/waybar/configs/[TOP] Default (old v3) -> config/waybar/configs/TOP-Default-old-v3 renamed: config/waybar/configs/[TOP] Default (old v4) -> config/waybar/configs/TOP-Default-old-v4 renamed: config/waybar/configs/[TOP] Everforest -> config/waybar/configs/TOP-Everforest renamed: config/waybar/configs/[TOP] Everforest-glass -> config/waybar/configs/TOP-Everforest-glass renamed: config/waybar/configs/[TOP] Gardenia -> config/waybar/configs/TOP-Gardenia renamed: config/waybar/configs/[TOP] Minimal - Long -> config/waybar/configs/TOP-Minimal-Long renamed: config/waybar/configs/[TOP] Minimal - Short -> config/waybar/configs/TOP-Minimal-Short renamed: config/waybar/configs/[TOP] Peony -> config/waybar/configs/TOP-Peony renamed: config/waybar/configs/[TOP] Simple -> config/waybar/configs/TOP-Simple renamed: config/waybar/configs/[TOP] Simpliest -> config/waybar/configs/TOP-Simpliest renamed: config/waybar/configs/[TOP] Sleek -> config/waybar/configs/TOP-Sleek new file: config/waybar/configs/TOP-ddubs-simple-bar modified: config/waybar/style.css renamed: config/waybar/style/[0 VERTICAL] [Catpuccin] Mocha.css -> config/waybar/style/0-VERTICAL-Catpuccin-Mocha.css renamed: config/waybar/style/[0 VERTICAL] Golden Noir.css -> config/waybar/style/0-VERTICAL-Golden-Noir.css renamed: config/waybar/style/[0 VERTICAL] Oglo Chicklets.css -> config/waybar/style/0-VERTICAL-Oglo-Chicklets.css renamed: config/waybar/style/[Black & White] Monochrome.css -> config/waybar/style/Black-&-White-Monochrome.css renamed: config/waybar/style/[Catppuccin] Frappe.css -> config/waybar/style/Catppuccin-Frappe.css renamed: config/waybar/style/[Catppuccin] Latte.css -> config/waybar/style/Catppuccin-Latte.css renamed: config/waybar/style/[Catppuccin] Mocha.css -> config/waybar/style/Catppuccin-Mocha.css renamed: config/waybar/style/[Colored] Chroma Glow.css -> config/waybar/style/Colored-Chroma-Glow.css renamed: config/waybar/style/[Colored] Translucent.css -> config/waybar/style/Colored-Translucent.css renamed: config/waybar/style/[Colorful] Aurora Blossom.css -> config/waybar/style/Colorful-Aurora-Blossom.css renamed: config/waybar/style/[Colorful] Aurora.css -> config/waybar/style/Colorful-Aurora.css renamed: config/waybar/style/[Colorful] Oglo Chicklets.css -> config/waybar/style/Colorful-Oglo-Chicklets.css renamed: config/waybar/style/[Colorful] Rainbow Spectrum.css -> config/waybar/style/Colorful-Rainbow-Spectrum.css renamed: config/waybar/style/[Colorful] stolen-style.css -> config/waybar/style/Colorful-stolen-style.css renamed: config/waybar/style/Crystal Clear Glass.css -> config/waybar/style/Crystal-Clear-Glass.css renamed: config/waybar/style/[Dark] Golden Eclipse.css -> config/waybar/style/Dark-Golden-Eclipse.css renamed: config/waybar/style/[Dark] Golden Noir.css -> config/waybar/style/Dark-Golden-Noir.css renamed: config/waybar/style/[Dark] Half-Moon.css -> config/waybar/style/Dark-Half-Moon.css renamed: config/waybar/style/[Dark] Latte-Wallust combined v2.css -> config/waybar/style/Dark-Latte-Wallust-combined-v2.css renamed: config/waybar/style/[Dark] Latte-Wallust combined.css -> config/waybar/style/Dark-Latte-Wallust-combined.css renamed: config/waybar/style/[Dark] Purpl.css -> config/waybar/style/Dark-Purpl.css renamed: config/waybar/style/[Dark] Wallust Obsidian Edge.css -> config/waybar/style/Dark-Wallust-Obsidian-Edge.css renamed: config/waybar/style/[Extra] Arrow.css -> config/waybar/style/Extra-Arrow.css renamed: config/waybar/style/[Extra] Crimson.css -> config/waybar/style/Extra-Crimson.css renamed: config/waybar/style/[Extra] EverForest.css -> config/waybar/style/Extra-EverForest.css renamed: config/waybar/style/[Extra] ML4W starter.css -> config/waybar/style/Extra-ML4W-starter.css renamed: config/waybar/style/[Extra] Mauve.css -> config/waybar/style/Extra-Mauve.css renamed: config/waybar/style/[Extra] Modern-Combined - Transparent.css -> config/waybar/style/Extra-Modern-Combined-Transparent.css renamed: config/waybar/style/[Extra] Modern-Combined.css -> config/waybar/style/Extra-Modern-Combined.css renamed: config/waybar/style/[Extra] Neon Circuit.css -> config/waybar/style/Extra-Neon-Circuit.css renamed: config/waybar/style/[Extra] Prismatic Glow.css -> config/waybar/style/Extra-Prismatic-Glow.css renamed: config/waybar/style/[Extra] Rose Pine.css -> config/waybar/style/Extra-Rose-Pine.css renamed: config/waybar/style/[Extra] Simple Pink.css -> config/waybar/style/Extra-Simple-Pink.css renamed: config/waybar/style/[Light] Monochrome Contrast.css -> config/waybar/style/Light-Monochrome-Contrast.css renamed: config/waybar/style/[Light] Obsidian Glow.css -> config/waybar/style/Light-Obsidian-Glow.css renamed: config/waybar/style/ML4W Glass-3d.css -> config/waybar/style/ML4W-Glass-3d.css renamed: config/waybar/style/ML4W Glass.css -> config/waybar/style/ML4W-Glass.css renamed: config/waybar/style/[Rainbow] RGB Bordered.css -> config/waybar/style/Rainbow-RGB-Bordered.css renamed: config/waybar/style/[Retro] Simple Style.css -> config/waybar/style/Retro-Simple-Style.css renamed: config/waybar/style/[Transparent] Crystal Clear.css -> config/waybar/style/Transparent-Crystal-Clear.css renamed: config/waybar/style/[VERTICAL] [Catpuccin] Mocha.css -> config/waybar/style/VERTICAL-Catpuccin-Mocha.css renamed: config/waybar/style/[Wallust Bordered] Chroma Fusion Edge.css -> config/waybar/style/Wallust-Bordered-Chroma-Fusion-Edge.css renamed: config/waybar/style/[Wallust Bordered] Chroma Simple.css -> config/waybar/style/Wallust-Bordered-Chroma-Simple.css renamed: config/waybar/style/[Wallust] Box type.css -> config/waybar/style/Wallust-Box-type.css renamed: config/waybar/style/[Wallust] Chroma Edge.css -> config/waybar/style/Wallust-Chroma-Edge.css renamed: config/waybar/style/[Wallust] Chroma Fusion.css -> config/waybar/style/Wallust-Chroma-Fusion.css renamed: config/waybar/style/[Wallust] Chroma Tally V2.css -> config/waybar/style/Wallust-Chroma-Tally-V2.css renamed: config/waybar/style/[Wallust] Chroma Tally.css -> config/waybar/style/Wallust-Chroma-Tally.css renamed: config/waybar/style/[Wallust] Colored.css -> config/waybar/style/Wallust-Colored.css renamed: config/waybar/style/[WALLUST] ML4W-modern-mixed.css -> config/waybar/style/Wallust-ML4W-modern-mixed.css renamed: config/waybar/style/[WALLUST] ML4W-modern.css -> config/waybar/style/Wallust-ML4W-modern.css renamed: config/waybar/style/[Wallust] Simple.css -> config/waybar/style/Wallust-Simple.css renamed: config/waybar/style/[Wallust Transparent] Crystal Clear.css -> config/waybar/style/Wallust-Transparent-Crystal-Clear.css modified: config/waybar/wallust/colors-waybar.css modified: copy.sh renamed: CODE_OF_CONDUCT.es.md -> i18n/CODE_OF_CONDUCT/CODE_OF_CONDUCT.es.md new file: i18n/CODE_OF_CONDUCT/CODE_OF_CONDUCT.fr.md renamed: COMMIT_MESSAGE_GUIDELINES.es.md -> i18n/COMMIT_MESSAGE_GUIDELINES/COMMIT_MESSAGE_GUIDELINES.es.md new file: i18n/COMMIT_MESSAGE_GUIDELINES/COMMIT_MESSAGE_GUIDELINES.fr.md renamed: CONTRIBUTING.es.md -> i18n/CONTRIBUTING/CONTRIBUTING.es.md new file: i18n/CONTRIBUTING/CONTRIBUTING.fr.md renamed: i18n/README.de.md -> i18n/README/README.de.md new file: i18n/README/README.fr.md renamed: i18n/README.jp.md -> i18n/README/README.jp.md renamed: i18n/README.ro.md -> i18n/README/README.ro.md renamed: i18n/README.ru.md -> i18n/README/README.ru.md renamed: i18n/README.ua.md -> i18n/README/README.ua.md modified: scripts/lib_apps.sh modified: scripts/lib_copy.sh modified: scripts/lib_prompts.sh
Diffstat (limited to 'config/hypr/UserScripts')
-rwxr-xr-xconfig/hypr/UserScripts/RainbowBorders-low-cpu.sh231
1 files changed, 231 insertions, 0 deletions
diff --git a/config/hypr/UserScripts/RainbowBorders-low-cpu.sh b/config/hypr/UserScripts/RainbowBorders-low-cpu.sh
new file mode 100755
index 00000000..bc0ab9ef
--- /dev/null
+++ b/config/hypr/UserScripts/RainbowBorders-low-cpu.sh
@@ -0,0 +1,231 @@
+#!/usr/bin/env bash
+# RainbowBorders-low-cpu.sh — low-overhead animated rainbow border for Hyprland
+#
+# Goal
+# Animate Hyprland's active border with a rotating rainbow gradient while
+# minimizing CPU usage on older systems by:
+# - Using a modest update rate (default 1.0s) and larger angle steps
+# - Avoiding subshell-heavy work inside the loop
+# - Using Hyprland's command socket via socat when available
+# - Quoting/validating inputs and suppressing noisy output
+# - Preventing multiple concurrent instances
+# - Optionally restoring the previous border value on exit
+#
+# Credits
+# Initial source/idea by: DemiGoD
+# Adaptation and optimization for low-CPU usage by: Hyprland-Dots maintainers
+#
+# Usage
+# You can customize behavior via environment variables when launching:
+# RB_INTERVAL Float seconds between updates (default: 1.0)
+# RB_STEP_DEG Integer degrees per tick (default: 10)
+# RB_START_DEG Integer starting angle (default: 0)
+# RB_TARGET Hypr option to update (default: general:col.active_border)
+# RB_COLORS Space-separated color list (default: 10-color rainbow below)
+# RB_RESTORE If "1", attempt to restore previous value on exit (loop mode; default: 1)
+# RB_LOCKFILE Path to a PID lock file (loop mode; default: /tmp/hypr-rainbowborders.lock)
+# RB_TRANSPORT auto|socat|hyprctl (default: auto)
+# - socat: send each command via Hyprland's command socket
+# using socat (one short-lived connection per tick)
+# - hyprctl: spawn hyprctl each tick
+# - auto: prefer socat if possible, otherwise hyprctl
+# RB_ONCE 1 to apply once and exit (no animation; default: 0)
+#
+# Example (slower animation):
+# RB_INTERVAL=1.5 RB_STEP_DEG=12 ~/.config/hypr/UserScripts/RainbowBorders-low-cpu.sh &
+#
+# Notes
+# - This focuses on the active border only. Animating inactive borders too
+# will increase updates and CPU usage.
+# - Higher RB_INTERVAL (e.g., 1.0–2.0s) and larger RB_STEP_DEG (10–20)
+# reduce per-second work substantially.
+
+set -u
+
+# Defaults (can be overridden by env vars)
+RB_INTERVAL="${RB_INTERVAL:-1.0}"
+RB_STEP_DEG="${RB_STEP_DEG:-10}"
+RB_START_DEG="${RB_START_DEG:-0}"
+RB_TARGET="${RB_TARGET:-general:col.active_border}"
+RB_COLORS_DEFAULT="0xffff0000 0xffff8000 0xffffff00 0xff80ff00 0xff00ff00 0xff00ff80 0xff00ffff 0xff0080ff 0xff0000ff 0xff8000ff"
+RB_COLORS="${RB_COLORS:-$RB_COLORS_DEFAULT}"
+RB_RESTORE="${RB_RESTORE:-1}"
+RB_LOCKFILE="${RB_LOCKFILE:-/tmp/hypr-rainbowborders.lock}"
+RB_TRANSPORT="${RB_TRANSPORT:-auto}"
+RB_ONCE="${RB_ONCE:-0}"
+
+# ---------- helpers ----------
+log() { printf '[RainbowBorders-low-cpu] %s\n' "$*" >&2; }
+
+die() { log "ERROR: $*"; exit 1; }
+
+usage() {
+ cat <<'EOF'
+Usage: RainbowBorders-low-cpu.sh [options]
+
+Options:
+ -h, --help Show this help and exit
+ --once, --run-once, -1
+ Apply the current gradient once and exit (no animation).
+ In this mode, RB_RESTORE is ignored (the color persists).
+
+Environment overrides:
+ RB_INTERVAL Seconds between updates (default: 1.0)
+ RB_STEP_DEG Degrees per tick (default: 10)
+ RB_START_DEG Starting angle (default: 0)
+ RB_TARGET Hypr option to update (default: general:col.active_border)
+ RB_COLORS Space-separated colors (default: 10-color rainbow)
+ RB_RESTORE 1 to restore previous value on exit (loop mode only; default: 1)
+ RB_LOCKFILE PID lock path (loop mode only; default: /tmp/hypr-rainbowborders.lock)
+ RB_TRANSPORT auto|socat|hyprctl (default: auto)
+ RB_ONCE 1 for one-shot mode (same as --once)
+
+Examples:
+ Animate (light CPU):
+ RB_INTERVAL=1.5 RB_STEP_DEG=12 ./RainbowBorders-low-cpu.sh &
+
+ Set a static rainbow once (no animation):
+ ./RainbowBorders-low-cpu.sh --once
+EOF
+}
+
+is_float() { [[ "$1" =~ ^[0-9]+(\.[0-9]+)?$|^\.[0-9]+$ ]]; }
+
+is_int() { [[ "$1" =~ ^[0-9]+$ ]]; }
+
+# ---------- parse CLI flags ----------
+while (( $# )); do
+ case "$1" in
+ -h|--help) usage; exit 0 ;;
+ --once|--run-once|-1) RB_ONCE=1 ;;
+ *) log "Unknown option: $1"; usage; exit 2 ;;
+ esac
+ shift
+done
+
+# ---------- validation ----------
+if ! is_float "$RB_INTERVAL"; then
+ log "WARN: RB_INTERVAL='$RB_INTERVAL' invalid; defaulting to 1.0"
+ RB_INTERVAL="1.0"
+fi
+if ! is_int "$RB_STEP_DEG"; then
+ log "WARN: RB_STEP_DEG='$RB_STEP_DEG' invalid; defaulting to 10"
+ RB_STEP_DEG="10"
+fi
+if ! is_int "$RB_START_DEG"; then
+ log "WARN: RB_START_DEG='$RB_START_DEG' invalid; defaulting to 0"
+ RB_START_DEG="0"
+fi
+
+# ---------- single-instance lock (PID file) ----------
+cleanup_lock() { [[ -f "$RB_LOCKFILE" ]] && rm -f "$RB_LOCKFILE"; }
+
+if [[ "$RB_ONCE" != "1" ]]; then
+ if [[ -f "$RB_LOCKFILE" ]]; then
+ oldpid="$(cat "$RB_LOCKFILE" 2>/dev/null || true)"
+ if [[ -n "${oldpid:-}" ]] && kill -0 "$oldpid" 2>/dev/null; then
+ log "Another instance is running (pid=$oldpid). Exiting."
+ exit 0
+ else
+ # Stale lock
+ rm -f "$RB_LOCKFILE" || true
+ fi
+ fi
+ printf '%d' "$$" >"$RB_LOCKFILE" 2>/dev/null || die "Cannot write lockfile $RB_LOCKFILE"
+fi
+
+# ---------- transport (socat vs hyprctl) ----------
+RB_MODE=""
+RB_SOCK=""
+
+open_transport() {
+ local want="$RB_TRANSPORT"
+ local uid; uid=$(id -u 2>/dev/null || echo 0)
+ local base="${XDG_RUNTIME_DIR:-/run/user/$uid}"
+ local sig="${HYPRLAND_INSTANCE_SIGNATURE:-}"
+ if [[ -n "$sig" ]]; then
+ RB_SOCK="$base/hypr/$sig/.socket.sock"
+ fi
+
+ # Prefer socat if requested/allowed and socket is available
+ if [[ "$want" == "socat" || "$want" == "auto" ]]; then
+ if command -v socat >/dev/null 2>&1 && [[ -n "$RB_SOCK" && -S "$RB_SOCK" ]]; then
+ RB_MODE="socat"
+ return 0
+ elif [[ "$want" == "socat" ]]; then
+ die "RB_TRANSPORT=socat requested but 'socat' or Hyprland socket is unavailable"
+ fi
+ fi
+
+ # Fallback to hyprctl: require presence and connectivity
+ command -v hyprctl >/dev/null 2>&1 || die "hyprctl not found and socat transport unavailable"
+ if ! hyprctl monitors >/dev/null 2>&1; then
+ die "hyprctl cannot reach a running Hyprland instance"
+ fi
+ RB_MODE="hyprctl"
+ return 0
+}
+
+open_transport || exit 1
+log "Using transport: $RB_MODE"
+
+# ---------- optional restore of previous border value ----------
+PREV_VALUE=""
+if [[ "$RB_RESTORE" == "1" && "$RB_ONCE" != "1" ]]; then
+ if command -v hyprctl >/dev/null 2>&1; then
+ # hyprctl getoption <opt> prints various formats; try common keys
+ PREV_VALUE="$(hyprctl getoption "$RB_TARGET" 2>/dev/null \
+ | sed -n 's/^.*str:[[:space:]]\+//p; s/^.*string:[[:space:]]\+//p; s/^.*value:[[:space:]]\+//p' \
+ | tail -n1)"
+ fi
+fi
+
+restore_previous() {
+ if [[ "$RB_RESTORE" == "1" && -n "${PREV_VALUE:-}" ]]; then
+ if [[ "$RB_MODE" == "socat" ]]; then
+ printf 'keyword %s %s\n' "$RB_TARGET" "$PREV_VALUE" | socat - "UNIX-CONNECT:$RB_SOCK" >/dev/null 2>&1 || true
+ else
+ hyprctl keyword "$RB_TARGET" "$PREV_VALUE" >/dev/null 2>&1 || true
+ fi
+ fi
+}
+
+on_exit() {
+ restore_previous
+ cleanup_lock
+}
+
+# In loop mode, set traps for cleanup/restore
+if [[ "$RB_ONCE" != "1" ]]; then
+ trap on_exit INT TERM EXIT
+fi
+
+# ---------- main logic ----------
+angle=$(( RB_START_DEG % 360 ))
+STEP=$(( RB_STEP_DEG % 360 ))
+(( STEP == 0 )) && STEP=10
+
+write_border() {
+ local a="$1"
+ if [[ "$RB_MODE" == "socat" ]]; then
+ printf 'keyword %s %s %sdeg\n' "$RB_TARGET" "$RB_COLORS" "$a" | socat - "UNIX-CONNECT:$RB_SOCK" >/dev/null 2>&1 || true
+ else
+ hyprctl keyword "$RB_TARGET" "$RB_COLORS ${a}deg" >/dev/null 2>&1 || true
+ fi
+}
+
+if [[ "$RB_ONCE" == "1" ]]; then
+ # Single write and exit; do not restore previous (intended to persist)
+ write_border "$angle" || log "WARN: one-shot write failed"
+ exit 0
+fi
+
+# Prime first write (avoid waiting one interval)
+write_border "$angle" || log "WARN: initial write failed"
+
+while :; do
+ # Advance angle and write; failures are non-fatal to keep CPU use minimal
+ angle=$(( (angle + STEP) % 360 ))
+ write_border "$angle"
+ sleep "$RB_INTERVAL"
+done
send patches to the email below
yukais@pinapelz.com
include the subject [PATCH repo_name]
pinapelz.com
homepage