quickshell: add notification sound with app muting

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
rope 2026-05-26 20:52:26 +01:00
parent 031c8d2166
commit c6dc2632c3

View file

@ -63,6 +63,7 @@ in
quickshell quickshell
qt6.qt5compat qt6.qt5compat
zenity zenity
libcanberra-gtk3
]; ];
# Use upstream anyrun flake's HM module instead of the built-in one # Use upstream anyrun flake's HM module instead of the built-in one
@ -498,6 +499,7 @@ in
readonly property string nmcli: "${nmcli}" readonly property string nmcli: "${nmcli}"
readonly property string wifiConnect: "${wifiConnectScript}" readonly property string wifiConnect: "${wifiConnectScript}"
readonly property string powerprofilesctl: "${powerprofilesctl}" readonly property string powerprofilesctl: "${powerprofilesctl}"
readonly property string notifSound: "${pkgs.libcanberra-gtk3}/bin/canberra-gtk-play"
} }
''; '';
}; };
@ -1722,6 +1724,7 @@ in
text = '' text = ''
import Quickshell import Quickshell
import Quickshell.Wayland import Quickshell.Wayland
import Quickshell.Io
import QtQuick import QtQuick
PanelWindow { PanelWindow {
@ -1731,10 +1734,17 @@ in
property var currentNotif: null property var currentNotif: null
property bool open: false property bool open: false
readonly property var mutedApps: ["discord", "Discord", "Spotify", "spotify", "vlc", "mpv"]
WlrLayershell.layer: WlrLayer.Overlay WlrLayershell.layer: WlrLayer.Overlay
WlrLayershell.namespace: "quickshell-toast" WlrLayershell.namespace: "quickshell-toast"
exclusionMode: ExclusionMode.Ignore exclusionMode: ExclusionMode.Ignore
Process {
id: notifSoundProc
command: [Commands.notifSound, "-i", "message"]
}
Connections { Connections {
target: shellRoot target: shellRoot
function onNotificationReceived() { function onNotificationReceived() {
@ -1747,6 +1757,9 @@ in
visible = true; visible = true;
open = true; open = true;
_toastTimer.restart(); _toastTimer.restart();
if (!mutedApps.includes(notification.appName)) {
notifSoundProc.running = true;
}
} }
function dismiss() { function dismiss() {