From 08a8ebbffd5b6ce80e25838796fb24f27f70381b Mon Sep 17 00:00:00 2001 From: outfoxxed Date: Fri, 9 Jan 2026 17:37:54 -0800 Subject: [PATCH] qs: add peak detection --- flake.lock | 68 +++++++++---------- .../shell/bar/audio/AudioControl.qml | 7 ++ .../quickshell/shell/bar/audio/Mixer.qml | 1 + .../shell/bar/audio/MixerEntryBase.qml | 8 +++ .../shell/bar/audio/VolumeSlider.qml | 18 ++++- 5 files changed, 67 insertions(+), 35 deletions(-) diff --git a/flake.lock b/flake.lock index bec760d..486a656 100644 --- a/flake.lock +++ b/flake.lock @@ -20,11 +20,11 @@ ] }, "locked": { - "lastModified": 1765900596, - "narHash": "sha256-+hn8v9jkkLP9m+o0Nm5SiEq10W0iWDSotH2XfjU45fA=", + "lastModified": 1767024902, + "narHash": "sha256-sMdk6QkMDhIOnvULXKUM8WW8iyi551SWw2i6KQHbrrU=", "owner": "hyprwm", "repo": "aquamarine", - "rev": "d83c97f8f5c0aae553c1489c7d9eff3eadcadace", + "rev": "b8a0c5ba5a9fbd2c660be7dd98bdde0ff3798556", "type": "github" }, "original": { @@ -59,15 +59,15 @@ "flake-compat": { "flake": false, "locked": { - "lastModified": 1761588595, - "narHash": "sha256-XKUZz9zewJNUj46b4AJdiRZJAvSZ0Dqj2BNfXvFlJC4=", - "owner": "edolstra", + "lastModified": 1767039857, + "narHash": "sha256-vNpUSpF5Nuw8xvDLj2KCwwksIbjua2LZCqhV1LNRDns=", + "owner": "NixOS", "repo": "flake-compat", - "rev": "f387cd2afec9419c8ee37694406ca490c3f34ee5", + "rev": "5edf11c44bc78a0d334f6334cdaf7d60d732daab", "type": "github" }, "original": { - "owner": "edolstra", + "owner": "NixOS", "repo": "flake-compat", "type": "github" } @@ -180,11 +180,11 @@ ] }, "locked": { - "lastModified": 1763733840, - "narHash": "sha256-JnET78yl5RvpGuDQy3rCycOCkiKoLr5DN1fPhRNNMco=", + "lastModified": 1766946335, + "narHash": "sha256-MRD+Jr2bY11MzNDfenENhiK6pvN+nHygxdHoHbZ1HtE=", "owner": "hyprwm", "repo": "hyprgraphics", - "rev": "8f1bec691b2d198c60cccabca7a94add2df4ed1a", + "rev": "4af02a3925b454deb1c36603843da528b67ded6c", "type": "github" }, "original": { @@ -218,11 +218,11 @@ "xdph": "xdph" }, "locked": { - "lastModified": 1767201430, - "narHash": "sha256-2FF66EaIbsc7CL1jKHbRFslSePDq40fzlTTbUlm5v3k=", + "lastModified": 1767907620, + "narHash": "sha256-zpQr4jkAoARBI22dFDnRekUagdRt6Mfc+ThpSSHm90s=", "owner": "hyprwm", "repo": "Hyprland", - "rev": "48a024e0322bbd7c4c88126498ec478444ec4cb2", + "rev": "5b1b79c29c5e0ea974b2a9da5d122dd0f3bedca6", "type": "github" }, "original": { @@ -264,11 +264,11 @@ ] }, "locked": { - "lastModified": 1765643131, - "narHash": "sha256-CCGohW5EBIRy4B7vTyBMqPgsNcaNenVad/wszfddET0=", + "lastModified": 1767023960, + "narHash": "sha256-R2HgtVS1G3KSIKAQ77aOZ+Q0HituOmPgXW9nBNkpp3Q=", "owner": "hyprwm", "repo": "hyprland-guiutils", - "rev": "e50ae912813bdfa8372d62daf454f48d6df02297", + "rev": "c2e906261142f5dd1ee0bfc44abba23e2754c660", "type": "github" }, "original": { @@ -284,11 +284,11 @@ ] }, "locked": { - "lastModified": 1766381032, - "narHash": "sha256-Wuk2MULnGfgAbP1N/Rp6H6k7zG/ynDiy54mPvkt/4bM=", + "lastModified": 1767957561, + "narHash": "sha256-N0kFdc6tSE0yFeQ/Iit3KNrz4nf2K5xvP3juL7SUyhc=", "owner": "outfoxxed", "repo": "hy3", - "rev": "50643d625829f303239f9ec019021f17d7e9f3fc", + "rev": "3287049e79e9e51431de8c09f9192a18afa1bf35", "type": "github" }, "original": { @@ -464,11 +464,11 @@ ] }, "locked": { - "lastModified": 1766253200, - "narHash": "sha256-26qPwrd3od+xoYVywSB7hC2cz9ivN46VPLlrsXyGxvE=", + "lastModified": 1767473322, + "narHash": "sha256-RGOeG+wQHeJ6BKcsSB8r0ZU77g9mDvoQzoTKj2dFHwA=", "owner": "hyprwm", "repo": "hyprwire", - "rev": "1079777525b30a947c8d657fac158e00ae85de9d", + "rev": "d5e7d6b49fe780353c1cf9a1cf39fa8970bd9d11", "type": "github" }, "original": { @@ -519,11 +519,11 @@ ] }, "locked": { - "lastModified": 1730724501, - "narHash": "sha256-zvNdomPM86fUf0iAwJV1RQC8yAqDCKbCDJKIs4iIPy0=", + "lastModified": 1767942797, + "narHash": "sha256-ypny6yOP3Buh7UBmETW3R/el3nHdzYNOCMhVnCdm9U4=", "ref": "refs/heads/master", - "rev": "8f897ffb4a1575252c536c63db8be72f22b6a494", - "revCount": 1, + "rev": "8bdd6351a130f8ed8fe13c9ec87ed965c4d9912b", + "revCount": 2, "type": "git", "url": "https://git.outfoxxed.me/outfoxxed/nix-qml-support" }, @@ -578,11 +578,11 @@ ] }, "locked": { - "lastModified": 1765911976, - "narHash": "sha256-t3T/xm8zstHRLx+pIHxVpQTiySbKqcQbK+r+01XVKc0=", + "lastModified": 1767281941, + "narHash": "sha256-6MkqajPICgugsuZ92OMoQcgSHnD6sJHwk8AxvMcIgTE=", "owner": "cachix", "repo": "git-hooks.nix", - "rev": "b68b780b69702a090c8bb1b973bab13756cc7a27", + "rev": "f0927703b7b1c8d97511c4116eb9b4ec6645a0fa", "type": "github" }, "original": { @@ -598,11 +598,11 @@ ] }, "locked": { - "lastModified": 1766725085, - "narHash": "sha256-O2aMFdDUYJazFrlwL7aSIHbUSEm3ADVZjmf41uBJfHs=", + "lastModified": 1767949765, + "narHash": "sha256-sb9X1evrQI2+4qmYCCAHMSiJFqj4eAuZp5BwYrOiJmA=", "ref": "refs/heads/master", - "rev": "41828c4180fb921df7992a5405f5ff05d2ac2fff", - "revCount": 715, + "rev": "eecc2f88b3b12a672df79e74f2bd49ef65f0abdf", + "revCount": 721, "type": "git", "url": "https://git.outfoxxed.me/quickshell/quickshell" }, diff --git a/modules/user/modules/quickshell/shell/bar/audio/AudioControl.qml b/modules/user/modules/quickshell/shell/bar/audio/AudioControl.qml index 4e33856..3ce604b 100644 --- a/modules/user/modules/quickshell/shell/bar/audio/AudioControl.qml +++ b/modules/user/modules/quickshell/shell/bar/audio/AudioControl.qml @@ -10,6 +10,12 @@ ClickableIcon { PwObjectTracker { objects: [ node ] } + PwNodePeakMonitor { + id: peakMonitor + node: root.node + enabled: tooltip.visible + } + implicitHeight: width; acceptedButtons: Qt.LeftButton | Qt.RightButton; fillWindowWidth: true @@ -55,6 +61,7 @@ ClickableIcon { //enabled: !node.audio.muted value: node.audio.volume + peak: peakMonitor.peak onValueChanged: node.audio.volume = value } } diff --git a/modules/user/modules/quickshell/shell/bar/audio/Mixer.qml b/modules/user/modules/quickshell/shell/bar/audio/Mixer.qml index 1a44257..bb0bb2a 100644 --- a/modules/user/modules/quickshell/shell/bar/audio/Mixer.qml +++ b/modules/user/modules/quickshell/shell/bar/audio/Mixer.qml @@ -45,6 +45,7 @@ ColumnLayout { required property PwLinkGroup modelData; node: trackedNode.isSink ? modelData.source : modelData.target; state: modelData.state; + peakDetect: trackedNode.isSink image: { let icon = ""; diff --git a/modules/user/modules/quickshell/shell/bar/audio/MixerEntryBase.qml b/modules/user/modules/quickshell/shell/bar/audio/MixerEntryBase.qml index 52d3278..531b497 100644 --- a/modules/user/modules/quickshell/shell/bar/audio/MixerEntryBase.qml +++ b/modules/user/modules/quickshell/shell/bar/audio/MixerEntryBase.qml @@ -9,6 +9,7 @@ RowLayout { required property PwNode node; required property string image; required property Item headerComponent; + property bool peakDetect: true; property int state: PwLinkState.Unlinked; @@ -21,6 +22,12 @@ RowLayout { PwObjectTracker { objects: [ node ] } + PwNodePeakMonitor { + id: peakMonitor + node: root.node + enabled: root.peakDetect + } + ClickableIcon { image: root.image asynchronous: true @@ -44,6 +51,7 @@ RowLayout { Layout.fillWidth: true value: node.audio.volume + peak: root.peakDetect ? peakMonitor.peak : 1 onValueChanged: node.audio.volume = value } } diff --git a/modules/user/modules/quickshell/shell/bar/audio/VolumeSlider.qml b/modules/user/modules/quickshell/shell/bar/audio/VolumeSlider.qml index 1e22f73..04701cd 100644 --- a/modules/user/modules/quickshell/shell/bar/audio/VolumeSlider.qml +++ b/modules/user/modules/quickshell/shell/bar/audio/VolumeSlider.qml @@ -7,11 +7,13 @@ Item { property real to: 1.5 property real warning: 1.0 property real value: 0.0 + property real peak: 1.0 implicitWidth: groove.implicitWidth implicitHeight: 20 property real __valueOffset: ((value - from) / (to - from)) * groove.width + property real __peakOffset: peak * __valueOffset property real __wheelValue: -1 MouseArea { @@ -55,10 +57,24 @@ Item { } radius: 5 - color: "#80ceffff" + color: "#40ceffff" width: __valueOffset } + Rectangle { + id: peakFill + + anchors { + left: groove.left + top: groove.top + bottom: groove.bottom + } + + radius: 5 + color: "#60ceffff" + width: __peakOffset + } + Rectangle { id: groove