diff options
| author | Danilo M. <danix@danix.xyz> | 2026-09-16 12:39:30 +0200 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-09-16 12:39:30 +0200 |
| commit | 89047e7de22d367133e15a4d2112d11144ac7cb1 (patch) | |
| tree | 643b36c7cc090cf939186aa871fb50c9cb0aba30 /appearance | |
| parent | a33d90b5f662df235da027ec1978b6490894d796 (diff) | |
| download | quickshell-89047e7de22d367133e15a4d2112d11144ac7cb1.tar.gz quickshell-89047e7de22d367133e15a4d2112d11144ac7cb1.zip | |
feat(appearance): add the Idle tab
Rows for each listener with an enable toggle and a timeout field, the
command shown read-only. Save rewrites the file and restarts hypridle.
Diffstat (limited to 'appearance')
| -rw-r--r-- | appearance/AppearancePanel.qml | 1 | ||||
| -rw-r--r-- | appearance/IdleTab.qml | 91 |
2 files changed, 92 insertions, 0 deletions
diff --git a/appearance/AppearancePanel.qml b/appearance/AppearancePanel.qml index a4c12b6..333b3ff 100644 --- a/appearance/AppearancePanel.qml +++ b/appearance/AppearancePanel.qml @@ -42,6 +42,7 @@ Scope { Udt.refresh(); Wallpapers.refresh(); Hyprsunset.refresh(); + Hypridle.refresh(); root.open = true; } function close() { root.open = false; } diff --git a/appearance/IdleTab.qml b/appearance/IdleTab.qml new file mode 100644 index 0000000..be8ad99 --- /dev/null +++ b/appearance/IdleTab.qml @@ -0,0 +1,91 @@ +// Copyright (C) 2026 Danilo M. <danix@danix.xyz> +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License version 2 as +// published by the Free Software Foundation. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +import QtQuick + +Flickable { + contentHeight: col.implicitHeight + clip: true + + Column { + id: col + width: parent.width + spacing: 10 + + Text { + text: "Commands are fixed. Only the timeout and whether a listener runs are editable." + color: Theme.overlay + font { family: Theme.fontFamily; pixelSize: Theme.fontSize - 4 } + } + + Repeater { + model: Hypridle.listeners + Rectangle { + required property var modelData + required property int index + width: col.width + implicitHeight: 40 + radius: 8 + color: Qt.alpha(Theme.surface, modelData.enabled ? 0.4 : 0.2) + opacity: modelData.enabled ? 1 : 0.6 + + Row { + anchors.fill: parent + anchors.margins: 8 + spacing: 10 + + Toggle { + anchors.verticalCenter: parent.verticalCenter + checked: modelData.enabled + onToggled: Hypridle.listeners = Hypridle.listeners.map( + (l, i) => i === index ? Object.assign({}, l, { enabled: checked }) : l) + } + Text { + anchors.verticalCenter: parent.verticalCenter + width: 150 + text: Hypridle.describe(modelData) + color: Theme.text + font { family: Theme.fontFamily; pixelSize: Theme.fontSize - 3 } + } + Field { + anchors.verticalCenter: parent.verticalCenter + width: 70 + value: String(modelData.timeout) + placeholder: "seconds" + onEdited: Hypridle.listeners = Hypridle.listeners.map( + (l, i) => i === index + ? Object.assign({}, l, { timeout: parseInt(value, 10) || 0 }) : l) + } + Text { + anchors.verticalCenter: parent.verticalCenter + text: `${Math.floor(modelData.timeout / 60)}m ${modelData.timeout % 60}s` + color: Theme.subtext + font { family: Theme.fontFamily; pixelSize: Theme.fontSize - 4 } + } + Text { + anchors.verticalCenter: parent.verticalCenter + width: parent.width - 380 + elide: Text.ElideRight + text: modelData.onTimeout + color: Theme.overlay + font { family: Theme.fontFamily; pixelSize: Theme.fontSize - 5 } + } + } + } + } + + Tab { + text: "Save + Restart hypridle" + selected: true + onClicked: Hypridle.save() + } + } +} |
