From f747d82b9336bb7c691d39a1f001c0d30d7bfb95 Mon Sep 17 00:00:00 2001 From: Davi Ribeiro <104164579+Markus328@users.noreply.github.com> Date: Sat, 23 Aug 2025 07:21:35 -0300 Subject: 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> --- modules/bar/Bar.qml | 6 ++++++ modules/bar/components/IdleInhibitor.qml | 33 ++++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 modules/bar/components/IdleInhibitor.qml (limited to 'modules/bar') diff --git a/modules/bar/Bar.qml b/modules/bar/Bar.qml index 09cebee..518b72b 100644 --- a/modules/bar/Bar.qml +++ b/modules/bar/Bar.qml @@ -143,6 +143,12 @@ ColumnLayout { } } } + DelegateChoice { + roleValue: "idleInhibitor" + delegate: WrappedLoader { + sourceComponent: IdleInhibitor {} + } + } } } diff --git a/modules/bar/components/IdleInhibitor.qml b/modules/bar/components/IdleInhibitor.qml new file mode 100644 index 0000000..51e09ed --- /dev/null +++ b/modules/bar/components/IdleInhibitor.qml @@ -0,0 +1,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 + } +} -- cgit v1.2.3-freya