summaryrefslogtreecommitdiff
path: root/accounts/gkleen@sif/shell/quickshell/LidSwitchInhibitorWidget.qml
blob: 2be0692a45598ccce5f13a3a6b283a71a0331e9b (plain)
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
import Quickshell
import QtQuick
import Quickshell.Widgets
import qs.Services

Item {
  id: root

  width: icon.width + 8
  height: parent.height
  anchors.verticalCenter: parent.verticalCenter

  WrapperMouseArea {
    id: widgetMouseArea

    anchors.fill: parent

    hoverEnabled: true

    onClicked: InhibitorState.lidSwitchInhibited = !InhibitorState.lidSwitchInhibited

    Rectangle {
      anchors.fill: parent
      color: {
	if (widgetMouseArea.containsMouse) {
	  return "#33808080";
	}
	return "transparent";
      }

      Item {
	anchors.fill: parent

	MaterialDesignIcon {
	  id: icon

	  implicitSize: 14
	  anchors.centerIn: parent

	  icon: InhibitorState.lidSwitchInhibited ? "laptop-off" : "laptop"
	  color: InhibitorState.lidSwitchInhibited ? "#f28a21" : "#555"
	}
      }
    }
  }
}