quickshell: read live volume in OSD, drain slider at 0%
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
parent
7c0098a184
commit
e6f97fadd9
1 changed files with 30 additions and 17 deletions
|
|
@ -7035,8 +7035,17 @@ in
|
|||
function showVolume() {
|
||||
// The volume dropdown already shows the level live.
|
||||
if (bar.activeDropdown === volDropdown) return;
|
||||
show(volWidget.volIcon, volWidget.vol / 100,
|
||||
volWidget.muted ? Theme.base03 : Theme.base0D);
|
||||
// Read the audio object, not volWidget's derived
|
||||
// properties: this runs from the change signal, and
|
||||
// those bindings haven't re-evaluated yet — they
|
||||
// still hold the previous level.
|
||||
const a = volWidget.sink ? volWidget.sink.audio : null;
|
||||
if (!a) return;
|
||||
const v = a.volume;
|
||||
show(a.muted ? "volume-x"
|
||||
: v >= 0.5 ? "volume-2"
|
||||
: v > 0 ? "volume-1" : "volume",
|
||||
v, a.muted ? Theme.base03 : Theme.base0D);
|
||||
}
|
||||
|
||||
Connections {
|
||||
|
|
@ -7093,8 +7102,12 @@ in
|
|||
Rectangle {
|
||||
anchors.bottom: parent.bottom
|
||||
width: parent.width
|
||||
height: Math.max(parent.width,
|
||||
parent.height * Math.max(0, Math.min(1, osdItem.value)))
|
||||
// Round cap needs width as a floor, but
|
||||
// 0% draws nothing so the track reads
|
||||
// empty.
|
||||
height: osdItem.value <= 0 ? 0
|
||||
: Math.max(parent.width,
|
||||
parent.height * Math.min(1, osdItem.value))
|
||||
radius: parent.radius
|
||||
color: osdItem.fill
|
||||
Behavior on height {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue