nosignal-shell/modules/bar/components/IdleInhibitor.qml
Davi Ribeiro f747d82b93
bar: add idle inhibitor (#459)
* bar: add idle inhibitor

* bar: change idle inhibitor button color

* nix: link external scripts instead of install

* services/idleinhibitor: add IPC handler

* better styling

* move cpp scripts to assets/cpp

---------

Co-authored-by: Soramane <61896496+soramanew@users.noreply.github.com>
2025-08-23 20:21:35 +10:00

33 lines
807 B
QML

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
}
}