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.qml47
1 files changed, 46 insertions, 1 deletions
diff --git a/accounts/gkleen@sif/shell/quickshell/BrightnessWidget.qml b/accounts/gkleen@sif/shell/quickshell/BrightnessWidget.qml
index 664b28e2..7f9c1ad0 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,47 @@ 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.centerIn: parent
66
67 Text {
68 id: widgetTooltipText
69
70 font.pointSize: 10
71 font.family: "Fira Sans"
72 color: "white"
73
74 text: `${Math.round(Brightness.currBrightness * 100)}%`
75 }
76 }
77 }
33} 78}