diff options
| author | Don Williams <don.e.williams@gmail.com> | 2026-08-15 12:05:10 -0400 |
|---|---|---|
| committer | Pinapelz <yukais@pinapelz.com> | 2026-08-29 21:41:34 -0700 |
| commit | 845e801b873bf995cd7750edee136f9ce3c660e5 (patch) | |
| tree | 2e2cf4c0ca7e499fd10f9ab4561d44a1e35a5b34 | |
| parent | 464c2487d326f0b463343d8e485ac3e3129bab81 (diff) | |
Fixed(really) ToggleOpacity and ChangeBlur.sh
Signed-off-by: Don Williams <don.e.williams@gmail.com>
On branch development
Your branch is up to date with 'origin/development'.
Changes to be committed:
modified: CHANGELOG.md
modified: config/hypr/UserConfigs/ENVariables.conf
modified: config/hypr/scripts/ChangeBlur.sh
modified: config/hypr/scripts/ToggleOpacity.sh
| -rw-r--r-- | CHANGELOG.md | 1 | ||||
| -rw-r--r-- | config/hypr/UserConfigs/ENVariables.conf | 3 | ||||
| -rwxr-xr-x | config/hypr/scripts/ChangeBlur.sh | 36 | ||||
| -rwxr-xr-x[-rw-r--r--] | config/hypr/scripts/ToggleOpacity.sh | 38 |
4 files changed, 65 insertions, 13 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index a543693b..47e38890 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -39,6 +39,7 @@ ## Fixed: +- Fixed `ChangeBlur.sh` to be compatible with LUA workflow - Waybar fix caused two waybars to start in Debian. Fixed the fix - waybar startup delayed in Fedora when not using `hyprland-uwsm` session - Found several issues with Fedora b/c of `waybar.service` with Fedora diff --git a/config/hypr/UserConfigs/ENVariables.conf b/config/hypr/UserConfigs/ENVariables.conf index c9c229ed..811b555f 100644 --- a/config/hypr/UserConfigs/ENVariables.conf +++ b/config/hypr/UserConfigs/ENVariables.conf @@ -54,5 +54,8 @@ # env = AQ_MGPU_NO_EXPLICIT,1 # Disables explicit syncing on mgpu buffers # env = AQ_NO_MODIFIERS,1 # Disables modifiers for DRM buffers +# Force GTK3/GTK4 dark theme for apps like Thunar +env = GTK_THEME,Adwaita-dark + diff --git a/config/hypr/scripts/ChangeBlur.sh b/config/hypr/scripts/ChangeBlur.sh index ca1be5ad..098969fc 100755 --- a/config/hypr/scripts/ChangeBlur.sh +++ b/config/hypr/scripts/ChangeBlur.sh @@ -9,14 +9,36 @@ notif="${XDG_CONFIG_HOME:-$HOME/.config}/swaync/images" -STATE=$(hyprctl -j getoption decoration:blur:passes | jq ".int") +config_home="${XDG_CONFIG_HOME:-$HOME/.config}" +hypr_dir="$config_home/hypr" +lua_entry="$hypr_dir/hyprland.lua" +legacy_lua_entry="$config_home/hyprland.lua" + +if [[ -f "$lua_entry" || -f "$legacy_lua_entry" ]]; then + hypr_config_mode="lua" +else + hypr_config_mode="conf" +fi + +STATE=$(hyprctl -j getoption decoration:blur:passes 2>/dev/null | jq -r ".int // empty") +if [[ -z "$STATE" || "$STATE" == "null" ]]; then + STATE=$(hyprctl getoption decoration:blur:passes 2>/dev/null | awk 'NR==1{print $2}') +fi if [ "${STATE}" == "2" ]; then - hyprctl keyword decoration:blur:size 2 - hyprctl keyword decoration:blur:passes 1 - notify-send -e -u low -i "$notif/note.png" " Less Blur" + if [[ "$hypr_config_mode" == "lua" ]]; then + hyprctl eval "hl.config({ decoration = { blur = { size = 2, passes = 1 } } })" + else + hyprctl keyword decoration:blur:size 2 + hyprctl keyword decoration:blur:passes 1 + fi + notify-send -e -u low -i "$notif/note.png" " Less Blur" else - hyprctl keyword decoration:blur:size 5 - hyprctl keyword decoration:blur:passes 2 - notify-send -e -u low -i "$notif/ja.png" " Normal Blur" + if [[ "$hypr_config_mode" == "lua" ]]; then + hyprctl eval "hl.config({ decoration = { blur = { size = 5, passes = 2 } } })" + else + hyprctl keyword decoration:blur:size 5 + hyprctl keyword decoration:blur:passes 2 + fi + notify-send -e -u low -i "$notif/ja.png" " Normal Blur" fi diff --git a/config/hypr/scripts/ToggleOpacity.sh b/config/hypr/scripts/ToggleOpacity.sh index b3fa40d3..7aa58bfb 100644..100755 --- a/config/hypr/scripts/ToggleOpacity.sh +++ b/config/hypr/scripts/ToggleOpacity.sh @@ -5,17 +5,43 @@ # License: GNU GPLv3 # SPDX-License-Identifier: GPL-3.0-or-later # ================================================== -# Toggle active window opacity (opaque property). -# Uses flock so that if both .conf and .lua binds fire simultaneously -# (dual-config load), only the first execution runs and the second exits. +# Toggle active_opacity using Lua hl.config (or legacy keyword in conf mode). +# Uses flock to prevent double-execution from dual-config (.conf + .lua) loading. +TRANSPARENCY=0.85 +NORMAL=1.0 LOCK="/tmp/.hypr_toggle_opacity_${HYPRLAND_INSTANCE_SIGNATURE:-default}.lock" +config_home="${XDG_CONFIG_HOME:-$HOME/.config}" +hypr_dir="$config_home/hypr" +lua_entry="$hypr_dir/hyprland.lua" +legacy_lua_entry="$config_home/hyprland.lua" + +if [[ -f "$lua_entry" || -f "$legacy_lua_entry" ]]; then + hypr_config_mode="lua" +else + hypr_config_mode="conf" +fi + ( flock -n 200 || exit 0 - ADDR=$(hyprctl activewindow -j 2>/dev/null | jq -r '.address // empty') - [ -z "$ADDR" ] && exit 0 + CURRENT=$(hyprctl -j getoption decoration:active_opacity 2>/dev/null | jq -r '.float // empty') + if [[ -z "$CURRENT" || "$CURRENT" == "null" ]]; then + CURRENT=$(hyprctl getoption decoration:active_opacity 2>/dev/null | awk 'NR==1{print $2}') + fi + + IS_FULL=$(awk -v c="${CURRENT:-1.0}" 'BEGIN {print (c >= 0.999) ? "1" : "0"}') + + if [ "$IS_FULL" = "1" ]; then + TARGET="$TRANSPARENCY" + else + TARGET="$NORMAL" + fi - hyprctl setprop "address:${ADDR}" opaque toggle + if [[ "$hypr_config_mode" == "lua" ]]; then + hyprctl eval "hl.config({ decoration = { active_opacity = ${TARGET} } })" + else + hyprctl keyword decoration:active_opacity "$TARGET" + fi ) 200>"$LOCK" |
