summaryrefslogtreecommitdiff
path: root/modules/bar/components/IdleInhibitor.qml
blob: 51e09ed215dc41c6cf27e154f62d08d6a427caab (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
import qs.components
import qs.services
import qs.config
import Quickshell
import QtQuick

StyledRect {
    id: root

    implicitWidth: implicitHeight
    implicitHeight: icon.implicitHeight + Appearance.padding.small * 2

    radius: Appearance.rounding.full
    color: Qt.alpha(Colours.palette.m3primaryContainer, IdleInhibitor.enabled ? 1 : 0)

    StateLayer {
        function onClicked(): void {
            IdleInhibitor.enabled = !IdleInhibitor.enabled;
        }
    }

    MaterialIcon {
        id: icon

        anchors.centerIn: parent
        anchors.horizontalCenterOffset: -1

        text: "coffee"
        color: IdleInhibitor.enabled ? Colours.palette.m3onPrimaryContainer : Colours.palette.m3secondary
        font.bold: true
        font.pointSize: Appearance.font.size.normal
    }
}