From bcdc17bc607ffabd98a13df6d2a09cd795cf2ad9 Mon Sep 17 00:00:00 2001 From: Ciro Rivera Date: Thu, 24 Sep 2026 21:30:49 -0600 Subject: [PATCH] Sound: the volume feedback clicks like a dial The tick waited for the level to settle and played freedesktop's audio-volume-change once at the end. It is now a short, dry click on every step (each key press, each repeat of a held key, a drag at most every 35 ms), like the notches of a knob. The click is a 25 ms WAV synthesised for lucid (assets/volume-click.wav: a sharp contact transient ringing a few high modes, high-passed so it has no body), played with pw-play, whose start is steadier than paplay's when a held key fires 25 of them a second. Co-Authored-By: Claude Opus 5.5 --- assets/volume-click.wav | Bin 0 -> 2444 bytes lucidosd/Osd.qml | 25 +++++++++++++++---------- lucidprefs/AudioPage.qml | 2 +- 3 files changed, 16 insertions(+), 11 deletions(-) create mode 100644 assets/volume-click.wav diff --git a/assets/volume-click.wav b/assets/volume-click.wav new file mode 100644 index 0000000000000000000000000000000000000000..3247e2d4083f76cacdd034692d74965f2105b2ba GIT binary patch literal 2444 zcmeIu&r1|>7zXfXzRs+>xI<y0`n$FJ7_vxL#!+D>}%gg&*K0}w2$;lXSZNRy7 z?|$}VJpe;8{#KTp0fl%Q>L^RaTwR`Zc^kki9{yZ_zq=U23-r)t}H0-MJ*^h>?Q_i&8c#t!;1%@_;1gR9J7 z14S(26qb35*ZGWF>_ZlL+(a`za*5CRnt#}i6t1ENas1>uKX8-(*oXu=(SjIu_=Df1 zS)q+4oWL=d*q7EX?y|~S91)E=G4Z&^G7qR}A}YOzi22fT>5){hB&OW7w5s$OnAS*? k7*bkVz5>s{*9aE51`}+7emJ2(C=d#S0--=Ca99NX14)&y*Z=?k literal 0 HcmV?d00001 diff --git a/lucidosd/Osd.qml b/lucidosd/Osd.qml index de2020f..6eef0fc 100644 --- a/lucidosd/Osd.qml +++ b/lucidosd/Osd.qml @@ -26,6 +26,8 @@ PanelWindow { property bool capsLock: false property bool numLock: false property bool kbInitialized: false + readonly property string clickSound: Qt.resolvedUrl("../assets/volume-click.wav").toString().replace("file://", "") + property double lastClickAt: 0 // m3 shape, spacing and slider metrics, shared with lucidbar/System.qml readonly property int cardPadX: 16 @@ -146,6 +148,18 @@ PanelWindow { nudgeAnim.restart(); } + // a click on every step, like the notches of a dial: each press, each + // repeat of a held key, and a drag no more often than every 35 ms, so it + // stays a ratchet rather than a buzz + function volumeClick() { + const now = Date.now(); + if (now - osdWindow.lastClickAt < 35) + return ; + + osdWindow.lastClickAt = now; + Quickshell.execDetached(["pw-play", osdWindow.clickSound]); + } + function showVolume() { osdWindow.oscType = "volume"; osdWindow.levelValue = osdWindow.volumePercent; @@ -198,7 +212,7 @@ PanelWindow { return ; if (Prefs.soundVolumeFeedback && !osdWindow.volMuted) - volumeTick.restart(); + osdWindow.volumeClick(); osdWindow.showVolume(); } @@ -230,15 +244,6 @@ PanelWindow { objects: [osdWindow.sink, osdWindow.source] } - // waits for the level to settle, so a held key or a drag ticks once at the - // end rather than in a burst - Timer { - id: volumeTick - - interval: 140 - onTriggered: Quickshell.execDetached(["paplay", "/usr/share/sounds/freedesktop/stereo/audio-volume-change.oga"]) - } - Timer { interval: 800 running: true diff --git a/lucidprefs/AudioPage.qml b/lucidprefs/AudioPage.qml index 86d9a9c..0618099 100644 --- a/lucidprefs/AudioPage.qml +++ b/lucidprefs/AudioPage.qml @@ -179,7 +179,7 @@ Column { SettingRow { title: "Play a sound when the volume changes" resetKey: "soundVolumeFeedback" - description: "A short tick once the output volume settles, from the keys, the bar or anywhere else, so you can hear the new level." + description: "A click on every step, like turning a dial, from the keys, the bar or anywhere else, so you can hear the new level." M3Switch { checked: Prefs.soundVolumeFeedback