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 <noreply@anthropic.com>
This commit is contained in:
Ciro Rivera
2026-09-24 21:30:49 -06:00
Unverified
parent cad8cab3fb
commit bcdc17bc60
3 changed files with 16 additions and 11 deletions
Binary file not shown.
+15 -10
View File
@@ -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
+1 -1
View File
@@ -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