diff options
Diffstat (limited to 'accounts/gkleen@sif/shell/quickshell/WaylandInhibitorWidget.qml')
-rw-r--r-- | accounts/gkleen@sif/shell/quickshell/WaylandInhibitorWidget.qml | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/accounts/gkleen@sif/shell/quickshell/WaylandInhibitorWidget.qml b/accounts/gkleen@sif/shell/quickshell/WaylandInhibitorWidget.qml new file mode 100644 index 00000000..0512ff51 --- /dev/null +++ b/accounts/gkleen@sif/shell/quickshell/WaylandInhibitorWidget.qml | |||
@@ -0,0 +1,56 @@ | |||
1 | import Quickshell | ||
2 | import QtQuick | ||
3 | import Quickshell.Widgets | ||
4 | import Quickshell.Wayland | ||
5 | import qs.Services | ||
6 | |||
7 | Item { | ||
8 | id: root | ||
9 | |||
10 | required property var window | ||
11 | |||
12 | width: icon.width + 8 | ||
13 | height: parent.height | ||
14 | anchors.verticalCenter: parent.verticalCenter | ||
15 | |||
16 | IdleInhibitor { | ||
17 | id: inhibitor | ||
18 | enabled: InhibitorState.waylandIdleInhibited | ||
19 | window: root.window | ||
20 | } | ||
21 | |||
22 | WrapperMouseArea { | ||
23 | id: widgetMouseArea | ||
24 | |||
25 | anchors.fill: parent | ||
26 | |||
27 | hoverEnabled: true | ||
28 | cursorShape: Qt.PointingHandCursor | ||
29 | |||
30 | onClicked: InhibitorState.waylandIdleInhibited = !InhibitorState.waylandIdleInhibited | ||
31 | |||
32 | Rectangle { | ||
33 | anchors.fill: parent | ||
34 | color: { | ||
35 | if (widgetMouseArea.containsMouse) { | ||
36 | return "#33808080"; | ||
37 | } | ||
38 | return "transparent"; | ||
39 | } | ||
40 | |||
41 | Item { | ||
42 | anchors.fill: parent | ||
43 | |||
44 | MaterialDesignIcon { | ||
45 | id: icon | ||
46 | |||
47 | implicitSize: 14 | ||
48 | anchors.centerIn: parent | ||
49 | |||
50 | icon: inhibitor.enabled ? "eye" : "eye-off" | ||
51 | color: inhibitor.enabled ? "white" : "#555" | ||
52 | } | ||
53 | } | ||
54 | } | ||
55 | } | ||
56 | } | ||