summaryrefslogtreecommitdiff
path: root/accounts/gkleen@sif/shell/quickshell/BrightnessWidget.qml
diff options
context:
space:
mode:
Diffstat (limited to 'accounts/gkleen@sif/shell/quickshell/BrightnessWidget.qml')
-rw-r--r--accounts/gkleen@sif/shell/quickshell/BrightnessWidget.qml53
1 files changed, 52 insertions, 1 deletions
diff --git a/accounts/gkleen@sif/shell/quickshell/BrightnessWidget.qml b/accounts/gkleen@sif/shell/quickshell/BrightnessWidget.qml
index 664b28e2..3bb5a80e 100644
--- a/accounts/gkleen@sif/shell/quickshell/BrightnessWidget.qml
+++ b/accounts/gkleen@sif/shell/quickshell/BrightnessWidget.qml
@@ -5,7 +5,7 @@ import qs.Services
5 5
6Item { 6Item {
7 height: parent.height 7 height: parent.height
8 width: brightnessIcon.width 8 width: brightnessIcon.width + 8
9 anchors.verticalCenter: parent.verticalCenter 9 anchors.verticalCenter: parent.verticalCenter
10 10
11 WrapperMouseArea { 11 WrapperMouseArea {
@@ -13,6 +13,8 @@ Item {
13 13
14 anchors.fill: parent 14 anchors.fill: parent
15 15
16 hoverEnabled: true
17
16 property real sensitivity: (1 / 50) / 120 18 property real sensitivity: (1 / 50) / 120
17 onWheel: event => Brightness.currBrightness += event.angleDelta.y * sensitivity 19 onWheel: event => Brightness.currBrightness += event.angleDelta.y * sensitivity
18 20
@@ -30,4 +32,53 @@ Item {
30 } 32 }
31 } 33 }
32 } 34 }
35
36 PopupWindow {
37 id: tooltip
38
39 property bool nextVisible: widgetMouseArea.containsMouse || tooltipMouseArea.containsMouse
40
41 anchor {
42 item: widgetMouseArea
43 edges: Edges.Bottom | Edges.Left
44 }
45 visible: false
46
47 onNextVisibleChanged: hangTimer.restart()
48
49 Timer {
50 id: hangTimer
51 interval: 100
52 onTriggered: tooltip.visible = tooltip.nextVisible
53 }
54
55 implicitWidth: widgetTooltipText.contentWidth + 16
56 implicitHeight: widgetTooltipText.contentHeight + 16
57 color: "black"
58
59 WrapperMouseArea {
60 id: tooltipMouseArea
61
62 hoverEnabled: true
63 enabled: true
64
65 anchors.fill: parent
66
67 Item {
68 anchors.fill: parent
69
70 Text {
71 id: widgetTooltipText
72
73 anchors.centerIn: parent
74
75 font.pointSize: 10
76 font.family: "Fira Sans"
77 color: "white"
78
79 text: `${Math.round(Brightness.currBrightness * 100)}%`
80 }
81 }
82 }
83 }
33} 84}