From 912130c3b2c09123d933addde1fcf97373a5cdc1 Mon Sep 17 00:00:00 2001 From: Don Williams Date: Sat, 15 Aug 2026 11:26:57 -0400 Subject: Fixed opacity keybinds add: ToggleOpacity script Signed-off-by: Don Williams On branch development Your branch is up to date with 'origin/development'. Changes to be committed: modified: CHANGELOG.md modified: config/hypr/configs/Keybinds.conf modified: config/hypr/configs/system_keybinds.lua modified: config/hypr/lua/keybind_helpers.lua new file: config/hypr/scripts/ToggleOpacity.sh --- CHANGELOG.md | 2 ++ config/hypr/configs/Keybinds.conf | 2 +- config/hypr/configs/system_keybinds.lua | 2 +- config/hypr/lua/keybind_helpers.lua | 2 +- config/hypr/scripts/ToggleOpacity.sh | 21 +++++++++++++++++++++ 5 files changed, 26 insertions(+), 3 deletions(-) create mode 100644 config/hypr/scripts/ToggleOpacity.sh diff --git a/CHANGELOG.md b/CHANGELOG.md index 51ecaffa..a543693b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,8 @@ ## Added: +- `ToggleOpactiy.sh` + - LUA workflow the existing bindings didn't work - `virtual_workspaces.lua` - lua script to link monitors into one workspace(ish) - It finds all the monitors, then when you move to a differnt workspace they move together diff --git a/config/hypr/configs/Keybinds.conf b/config/hypr/configs/Keybinds.conf index 612ecc95..844f4905 100644 --- a/config/hypr/configs/Keybinds.conf +++ b/config/hypr/configs/Keybinds.conf @@ -70,7 +70,7 @@ bindd = $mainMod SHIFT, M, Online music, exec, $UserScripts/RofiBeats.sh bindd = $mainMod, W, Select Wallpaper, exec, $scriptsDir/WallpaperSelect.sh bindd = $mainMod SHIFT, W, Wallpaper effects, exec, $scriptsDir/WallpaperEffects.sh bindd = CTRL ALT, W, Random wallpaper, exec, $scriptsDir/WallpaperRandom.sh -bindd = $mainMod CTRL, O, Toggle active window opacity, setprop, active opaque toggle +bindd = $mainMod CTRL, O, Toggle active window opacity, exec, $scriptsDir/ToggleOpacity.sh bindd = $mainMod SHIFT, K, Search keybinds, exec, $scriptsDir/KeyBinds.sh bindd = $mainMod SHIFT, A, Animations menu, exec, $scriptsDir/Animations.sh bindd = $mainMod SHIFT, O, Change ZSH (oh-my-zsh) theme, exec, $scriptsDir/ZshChangeTheme.sh diff --git a/config/hypr/configs/system_keybinds.lua b/config/hypr/configs/system_keybinds.lua index ca03b2b9..dd654ccd 100644 --- a/config/hypr/configs/system_keybinds.lua +++ b/config/hypr/configs/system_keybinds.lua @@ -402,7 +402,7 @@ bind( exec_cmd("$HOME/.config/hypr/UserScripts/WallpaperRandom.sh"), { description = "random wallpaper" } ) -bind("SUPER CTRL", "O", dispatch("setprop", "active opaque toggle"), { description = "toggle active window opacity" }) +bind("SUPER CTRL", "O", exec_cmd("$HOME/.config/hypr/scripts/ToggleOpacity.sh"), { description = "toggle active window opacity" }) bind("SUPER SHIFT", "K", exec_cmd("$HOME/.config/hypr/scripts/KeyBinds.sh"), { description = "search keybinds" }) bind("SUPER SHIFT", "A", exec_cmd("$HOME/.config/hypr/scripts/Animations.sh"), { description = "animations menu" }) bind( diff --git a/config/hypr/lua/keybind_helpers.lua b/config/hypr/lua/keybind_helpers.lua index 8240cc60..1b1a269b 100644 --- a/config/hypr/lua/keybind_helpers.lua +++ b/config/hypr/lua/keybind_helpers.lua @@ -213,7 +213,7 @@ local function dispatch(name, args) return window_api.bring_to_top() end if name == "setprop" and window_api.set_prop then - local prop, value = args:match("^(%S+)%s+(.+)$") + local _win, prop, value = args:match("^(%S+)%s+(%S+)%s+(.+)$") if prop and value then return window_api.set_prop({ prop = prop, value = value }) end diff --git a/config/hypr/scripts/ToggleOpacity.sh b/config/hypr/scripts/ToggleOpacity.sh new file mode 100644 index 00000000..b3fa40d3 --- /dev/null +++ b/config/hypr/scripts/ToggleOpacity.sh @@ -0,0 +1,21 @@ +#!/usr/bin/env bash +# ================================================== +# KoolDots (2026) +# Project URL: https://github.com/LinuxBeginnings +# 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. + +LOCK="/tmp/.hypr_toggle_opacity_${HYPRLAND_INSTANCE_SIGNATURE:-default}.lock" + +( + flock -n 200 || exit 0 + + ADDR=$(hyprctl activewindow -j 2>/dev/null | jq -r '.address // empty') + [ -z "$ADDR" ] && exit 0 + + hyprctl setprop "address:${ADDR}" opaque toggle +) 200>"$LOCK" -- cgit v1.2.3