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() {
|
function showVolume() {
|
||||||
// The volume dropdown already shows the level live.
|
// The volume dropdown already shows the level live.
|
||||||
if (bar.activeDropdown === volDropdown) return;
|
if (bar.activeDropdown === volDropdown) return;
|
||||||
show(volWidget.volIcon, volWidget.vol / 100,
|
// Read the audio object, not volWidget's derived
|
||||||
volWidget.muted ? Theme.base03 : Theme.base0D);
|
// 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 {
|
Connections {
|
||||||
|
|
@ -7093,8 +7102,12 @@ in
|
||||||
Rectangle {
|
Rectangle {
|
||||||
anchors.bottom: parent.bottom
|
anchors.bottom: parent.bottom
|
||||||
width: parent.width
|
width: parent.width
|
||||||
height: Math.max(parent.width,
|
// Round cap needs width as a floor, but
|
||||||
parent.height * Math.max(0, Math.min(1, osdItem.value)))
|
// 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
|
radius: parent.radius
|
||||||
color: osdItem.fill
|
color: osdItem.fill
|
||||||
Behavior on height {
|
Behavior on height {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue