From bf31806ab72b31daab0d150e255e09826308ccb0 Mon Sep 17 00:00:00 2001 From: djairoh Date: Sat, 17 Oct 2026 16:14:41 +0200 Subject: [PATCH] ft: mute_active overhaul no longer toggles grey shader, just makes the border grey + fixed mute_active dunst notif + keybinds --- modules/desktop/hypr-bindings.nix | 3 +-- modules/desktop/hypr-plugins.nix | 2 -- modules/desktop/hypr-rules.nix | 2 +- scripts/WMScripts/mute_active.sh | 22 +++++++++++++++++----- scripts/hypr-windowShaders/muted.glsl | 9 --------- 5 files changed, 19 insertions(+), 19 deletions(-) delete mode 100644 scripts/hypr-windowShaders/muted.glsl diff --git a/modules/desktop/hypr-bindings.nix b/modules/desktop/hypr-bindings.nix index e27d404..9344683 100644 --- a/modules/desktop/hypr-bindings.nix +++ b/modules/desktop/hypr-bindings.nix @@ -30,8 +30,7 @@ in (bind "${mainMod} + N" (exec "dunstctl close-all") "Clear dunst notifications") (bind "${mainMod} + SHIFT + N" (exec "~/.config/WMScripts/dunst.sh") "Toggle dunst notifications") (bind "CTRL + SHIFT + ESCAPE" (exec "~/.config/WMScripts/murder.sh") "Terminate a program") - (bind "${mainMod} + CTRL + M" (exec "~/.config/WMScripts/mute_active.sh") "Toggle mute active window") - (bind "${mainMod} + CTRL + SHIFT + M" (exec "~/.config/WMScripts/mute_active.sh muted") "Toggle mute active window and apply the 'muted' shader") + (bind "${mainMod} + CTRL + M" (exec "~/.config/WMScripts/mute_active.sh muted") "Toggle mute active window") (bind "${mainMod} + M" (exec "~/.config/WMScripts/toggle_audiocables.sh combine") "Toggle hyperx audio output") (bind "${mainMod} + SHIFT + M" (exec "~/.config/WMScripts/toggle_audiocables.sh clementine") "Toggle clementine audio output") (bind "${mainMod} + Q" (exec "killall deadcells") "Murder Dead cells specifically") diff --git a/modules/desktop/hypr-plugins.nix b/modules/desktop/hypr-plugins.nix index 4109e64..b1404ec 100644 --- a/modules/desktop/hypr-plugins.nix +++ b/modules/desktop/hypr-plugins.nix @@ -32,8 +32,6 @@ in ]; window_rule = [ - { match.tag = "shader/muted"; "darkwindow:shade" = "grey";} - { match.tag = "muted"; "darkwindow:shade" = "grey";} ] ++ map (name: { match.tag = "shader/${name}"; "darkwindow:shade" = "${name}";}) shaders; }; diff --git a/modules/desktop/hypr-rules.nix b/modules/desktop/hypr-rules.nix index 35f0d5e..df7c3e0 100644 --- a/modules/desktop/hypr-rules.nix +++ b/modules/desktop/hypr-rules.nix @@ -68,7 +68,7 @@ { match.class = ".*"; suppress_event = "maximize";} # muted tag - { match.tag = "muted"; border_color = { colors = [ + { match.tag = "shader/muted"; border_color = { colors = [ (lib.generators.mkLuaInline "colors.subtext0") # stupid hack to use catppuccin-nix colors (lib.generators.mkLuaInline "colors.subtext1") ]; angle = 45;};} diff --git a/scripts/WMScripts/mute_active.sh b/scripts/WMScripts/mute_active.sh index fa00232..5687006 100755 --- a/scripts/WMScripts/mute_active.sh +++ b/scripts/WMScripts/mute_active.sh @@ -41,14 +41,26 @@ esac sinks=$(pactl -f json list sink-inputs) binary=$(ps -q "$activePid" -o comm=) +windowName="$binary" mutableSinks=$(printf "%s" "$sinks" | jq -r ".[] | select(.properties.\"application.process.id\" == \"$activePid\") | .index") # fallbacks -[[ -z "$mutableSinks" ]] && mutableSinks=$(printf "%s" "$sinks" | jq -r ".[] | select(.properties.\"application.process.binary\" == \"$binary\") | .index") # Feishin -[[ -z "$mutableSinks" ]] && mutableSinks=$(printf "%s" "$sinks" | jq -r ".[] | select(.properties.\"application.id\" == \"$binary\") | .index") # mpv -[[ -z "$mutableSinks" && "$class" = \"tf_linux64\" ]] && mutableSinks=$(printf "%s" "$sinks" | jq -r ".[] | select(.properties.\"application.name\" == \"tf_linux64\" ) .index") # tf2 - +if [[ -z "$mutableSinks" ]]; then + # feishin + mutableSinks=$(printf "%s" "$sinks" | jq -r ".[] | select(.properties.\"application.process.binary\" == \"$binary\") | .index") + windowName="Feishin" +fi +if [[ -z "$mutableSinks" ]]; then + # mpv + mutableSinks=$(printf "%s" "$sinks" | jq -r ".[] | select(.properties.\"application.id\" == \"$binary\") | .index") + windowName="Mpv" +fi +if [[ -z "$mutableSinks" && "$class" = \"tf_linux64\" ]]; then + # tf2 + mutableSinks=$(printf "%s" "$sinks" | jq -r ".[] | select(.properties.\"application.name\" == \"tf_linux64\" ) .index") + windowName="TF2" +fi if [[ -z "$mutableSinks" ]]; then @@ -66,7 +78,7 @@ else -a Mute \ -r 35 \ -i ~/.icons/candy-icons/apps/scalable/yast-sound.svg \ - "Toggled mute on active window" + "Toggled mute on active window ($windowName)" fi toggle_multiple "$mutableSinks" diff --git a/scripts/hypr-windowShaders/muted.glsl b/scripts/hypr-windowShaders/muted.glsl deleted file mode 100644 index 3d3901b..0000000 --- a/scripts/hypr-windowShaders/muted.glsl +++ /dev/null @@ -1,9 +0,0 @@ -// Values obtained from: http://en.wikipedia.org/wiki/Grayscale#Luma_coding_in_video_systems -vec3 LumaFactors = vec3(0.299, 0.587, 0.114); - -void windowShader(inout vec4 color) { - // Desaturate to luma only - float luma = dot(vec3(color.r, color.g, color.b), LumaFactors); - - color.rgb = vec3(luma, luma, luma); -}