feat(osd): add volume osd popup window

This commit is contained in:
tux
2026-08-24 18:18:10 +05:30
parent 28aa79dd13
commit abd48a9c66
5 changed files with 106 additions and 0 deletions

52
windows/Volume.qml Normal file
View File

@@ -0,0 +1,52 @@
pragma ComponentBehavior: Bound
import QtQuick
import Quickshell
import qs.config
import qs.services
import "../modules/osd"
PanelWindow {
id: root
property bool shown: false
color: "transparent"
exclusionMode: ExclusionMode.Ignore
visible: shown
implicitWidth: card.implicitWidth
implicitHeight: card.implicitHeight
anchors.bottom: true
margins.bottom: screen.height * Theme.volume.bottomMarginRatio
// An empty click mask prevents the window from blocking mouse events.
mask: Region {}
Connections {
target: Audio
function onVolumeChanged() {
root.shown = true;
hideTimer.restart();
}
function onMutedChanged() {
root.shown = true;
hideTimer.restart();
}
}
Timer {
id: hideTimer
interval: Theme.volume.timeout
onTriggered: root.shown = false
}
VolumeCard {
id: card
anchors.fill: parent
}
}