diff options
| -rw-r--r-- | CHANGELOG.md | 20 | ||||
| -rwxr-xr-x | config/hypr/UserScripts/RainbowBorders.sh | 92 | ||||
| -rwxr-xr-x | config/hypr/scripts/Kool_Quick_Settings.sh | 74 |
3 files changed, 170 insertions, 16 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index e22cb1be..9a9ecb61 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,14 +2,20 @@ ## v2.3.19 -- 2026-01-15 - - Created waybar configs for ML4W Glass style - - `TOP & Bottom Summit - glass` - - `Default Laptop - Glass` - - `Everforest - Glass` - - Fixed menu for express-update - - Fixed `Toggle Rainbow` checked for wrong file +- 2026-01-16 +- Added `Rainbow Borders sub memu` + - Code provided by [brunoorsolon](https://github.com/brunoorsolon) + - There are now mulitple modes for the Rainbow Borders feature + - `Disabled`, `Wallust Color`, `Rainbow`, `Gradient flow` + - Thank you for the submission +- 2026-01-15 +- Created waybar configs for ML4W Glass style +- `TOP & Bottom Summit - glass` +- `Default Laptop - Glass` +- `Everforest - Glass` +- Fixed menu for express-update +- Fixed `Toggle Rainbow` checked for wrong file - 2026-01-13 - Added `Toggle Rainbow borders` option to settings menu diff --git a/config/hypr/UserScripts/RainbowBorders.sh b/config/hypr/UserScripts/RainbowBorders.sh index 0a7fd721..7a392ffe 100755 --- a/config/hypr/UserScripts/RainbowBorders.sh +++ b/config/hypr/UserScripts/RainbowBorders.sh @@ -1,14 +1,92 @@ #!/usr/bin/env bash # /* ---- 💫 https://github.com/JaKooLit 💫 ---- */ ## -# for rainbow borders animation +# Smooth border cycling effect using Wallust palette or full rainbow +# Possible values: "wallust_random", "rainbow", "gradient_flow" +EFFECT_TYPE="gradient_flow" + +WALLUST_COLORS_SOURCE="$HOME/.config/hypr/wallust/wallust-hyprland.conf" + +WALLUST_COLORS=() + +# ---------- LOAD WALLUST COLORS ---------- +if [[ "$EFFECT_TYPE" == "wallust_random" || "$EFFECT_TYPE" == "gradient_flow" ]]; then + # Accept either hex (0xffRRGGBB) or rgb(r,g,b) and normalize to 0xffRRGGBB + mapfile -t WALLUST_COLORS < <( + grep -E '^\$color[0-9]+' "$WALLUST_COLORS_SOURCE" | awk ' + function hex2(s){ return (length(s)==6 ? "0xff"s : ""); } + function rgb2(r,g,b){ return sprintf("0xff%02x%02x%02x", r, g, b); } + { + if (match($0, /0x([0-9a-fA-F]{8})/, m)) { print "0x" m[1]; next } + if (match($0, /#([0-9a-fA-F]{6})/, m)) { print hex2(m[1]); next } + if (match($0, /rgb\(([0-9]+),[ ]*([0-9]+),[ ]*([0-9]+)\)/, m)) { + print rgb2(m[1], m[2], m[3]); next + } + }' + ) + + if (( ${#WALLUST_COLORS[@]} == 0 )); then + if [[ "$EFFECT_TYPE" == "wallust_random" ]]; then + echo "ERROR: wallust_random enabled but no colors loaded" >&2 + exit 1 + fi + # gradient_flow will fall back to random_hex later + fi +fi + +# ---------- RANDOM WALLUST COLORS ---------- +function wallust_random() { + echo "${WALLUST_COLORS[RANDOM % ${#WALLUST_COLORS[@]}]}" +} + +# ---------- RAINBOW COLORS ---------- function random_hex() { - random_hex=("0xff$(openssl rand -hex 3)") - echo $random_hex + echo "0xff$(openssl rand -hex 3)" +} + +# ---------- FLOW MODE ---------- +BASE_COLOR="${WALLUST_COLORS[10]}" +GRAD1_COLOR="${WALLUST_COLORS[14]}" +GRAD2_COLOR="${WALLUST_COLORS[13]}" +GLOW_COLOR="${WALLUST_COLORS[15]}" + +MAX_POS=10 +GLOW_POS=0 + +function gradient_flow_color() { + local pos=$1 + local d=$(( pos - GLOW_POS )) + + # wrap distance (-9..9) + if (( d > MAX_POS/2 )); then d=$((d - MAX_POS)); fi + if (( d < -MAX_POS/2 )); then d=$((d + MAX_POS)); fi + + case "${d#-}" in + 0) echo "$GLOW_COLOR" ;; + 1) echo "$GRAD1_COLOR" ;; + 2) echo "$GRAD2_COLOR" ;; + *) echo "$BASE_COLOR" ;; + esac + + if (( pos == MAX_POS - 1 )); then + GLOW_POS=$(( (GLOW_POS + 1) % MAX_POS )) + fi +} + +# ---------- Main function ---------- + +function get_color() { + if [[ "$EFFECT_TYPE" == "wallust_random" && ${#WALLUST_COLORS[@]} -gt 0 ]]; then + wallust_random + elif [[ "$EFFECT_TYPE" == "gradient_flow" && ${#WALLUST_COLORS[@]} -ge 16 ]]; then + gradient_flow_color "$1" + else + random_hex + fi } -# rainbow colors only for active window -hyprctl keyword general:col.active_border $(random_hex) $(random_hex) $(random_hex) $(random_hex) $(random_hex) $(random_hex) $(random_hex) $(random_hex) $(random_hex) $(random_hex) 270deg +# border effect for ACTIVE window +hyprctl keyword general:col.active_border $(get_color 0) $(get_color 1) $(get_color 2) $(get_color 3) $(get_color 4) $(get_color 5) $(get_color 6) $(get_color 7) $(get_color 8) $(get_color 9) 270deg -# rainbow colors for inactive window (uncomment to take effect) -#hyprctl keyword general:col.inactive_border $(random_hex) $(random_hex) $(random_hex) $(random_hex) $(random_hex) $(random_hex) $(random_hex) $(random_hex) $(random_hex) $(random_hex) 270deg
\ No newline at end of file +# border effect for INACTIVE windows +#hyprctl keyword general:col.inactive_border $(get_color 0) $(get_color 1) $(get_color 2) $(get_color 3) $(get_color 4) $(get_color 5) $(get_color 6) $(get_color 7) $(get_color 8) $(get_color 9) 270deg
\ No newline at end of file diff --git a/config/hypr/scripts/Kool_Quick_Settings.sh b/config/hypr/scripts/Kool_Quick_Settings.sh index c8f71d06..5f0193ed 100755 --- a/config/hypr/scripts/Kool_Quick_Settings.sh +++ b/config/hypr/scripts/Kool_Quick_Settings.sh @@ -74,6 +74,76 @@ toggle_rainbow_borders() { fi } +# Submenu to choose Rainbow Borders mode (disable, wallust_random, rainbow, gradient_flow) +rainbow_borders_menu() { + local rainbow_script="$UserScripts/RainbowBorders.sh" + local disabled_sh_bak="${rainbow_script}.bak" + local disabled_bak_sh="$UserScripts/RainbowBorders.bak.sh" + local refresh_script="$scriptsDir/Refresh.sh" + + # Determine current mode/status + local current="disabled" + if [[ -f "$rainbow_script" ]]; then + current=$(grep -E '^EFFECT_TYPE=' "$rainbow_script" 2>/dev/null | sed -E 's/^EFFECT_TYPE="?([^"]*)"?.*/\1/') + [[ -z "$current" ]] && current="unknown" + fi + + # Build options and prompt + local options="disable\nwallust_random\nrainbow\ngradient_flow" + local choice + choice=$(printf "%b" "$options" | rofi -i -dmenu -config "$rofi_theme" -mesg "Rainbow Borders: choose mode (current: $current)") + + [[ -z "$choice" ]] && return + + case "$choice" in + disable|Disable) + if [[ -f "$rainbow_script" ]]; then + mv "$rainbow_script" "$disabled_sh_bak" + fi + current="disabled" + ;; + wallust_random|rainbow|gradient_flow) + # Ensure script is enabled + if [[ ! -f "$rainbow_script" ]]; then + if [[ -f "$disabled_sh_bak" ]]; then + mv "$disabled_sh_bak" "$rainbow_script" + elif [[ -f "$disabled_bak_sh" ]]; then + mv "$disabled_bak_sh" "$rainbow_script" + else + show_info "RainbowBorders script not found in $UserScripts." + return + fi + fi + + # Update EFFECT_TYPE in place; insert if missing + if grep -q '^EFFECT_TYPE=' "$rainbow_script" 2>/dev/null; then + sed -i 's/^EFFECT_TYPE=.*/EFFECT_TYPE="'"$choice"'"/' "$rainbow_script" + else + if head -n1 "$rainbow_script" | grep -q '^#!'; then + sed -i '1a EFFECT_TYPE="'"$choice"'"' "$rainbow_script" + else + sed -i '1i EFFECT_TYPE="'"$choice"'"' "$rainbow_script" + fi + fi + current="$choice" + ;; + *) + return ;; + esac + + # Run refresh if available + if [[ -x "$refresh_script" ]]; then + "$refresh_script" >/dev/null 2>&1 & + fi + + # Notify + if [[ "$current" == "disabled" ]]; then + show_info "Rainbow Borders disabled." + else + show_info "Rainbow Borders: $current." + fi +} + # Function to display the menu options without numbers menu() { cat <<EOF @@ -105,7 +175,7 @@ Choose Rofi Themes Search for Keybinds Toggle Game Mode Switch Dark-Light Theme -Toggle Rainbow Borders +Rainbow Borders Mode EOF } @@ -165,7 +235,7 @@ main() { "Search for Keybinds") $scriptsDir/KeyBinds.sh ;; "Toggle Game Mode") $scriptsDir/GameMode.sh ;; "Switch Dark-Light Theme") $scriptsDir/DarkLight.sh ;; - "Toggle Rainbow Borders") toggle_rainbow_borders ;; + "Rainbow Borders Mode") rainbow_borders_menu ;; *) return ;; # Do nothing for invalid choices esac |
