-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathVolumeOsd.qml
More file actions
80 lines (64 loc) · 1.97 KB
/
VolumeOsd.qml
File metadata and controls
80 lines (64 loc) · 1.97 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
import QtQuick
import Quickshell
import QtQuick.Layouts
import qs.services
import qs.MaterialDesign
Item {
id: root
property bool popupVisible: false
Connections {
target: Audio
function onVolumeChanged() {
root.shouldShowOsd = true;
hideTimer.restart();
}
}
property bool shouldShowOsd: false
Timer {
id: hideTimer
interval: 1000
onTriggered: root.shouldShowOsd = false
}
LazyLoader {
active: root.shouldShowOsd
PanelWindow {
anchors.bottom: true
margins.bottom: screen.height - 100
exclusiveZone: 0
implicitWidth: 400
implicitHeight: 50
color: "transparent"
// An empty click mask prevents the VolumeOsd from preventing clicks (you can click behind the osd)
mask: Region {}
RowLayout {
anchors {
fill: parent
leftMargin: 15
rightMargin: 15
}
Rectangle {
Layout.fillWidth: true
implicitHeight: 40
radius: 10
color: Theme.m3primaryContainer
Rectangle {
anchors {
left: parent.left
top: parent.top
bottom: parent.bottom
}
color: Theme.m3onPrimaryContainer
implicitWidth: parent.width * (Audio.volume)
radius: parent.radius
Behavior on implicitWidth {
NumberAnimation {
duration: 180
easing.type: Easing.cubicInOutwh
}
}
}
}
}
}
}
}