aboutsummaryrefslogtreecommitdiffstats
path: root/desktop/companion/Companion.qml
diff options
context:
space:
mode:
authorDanilo M. <danix@danix.xyz>2026-10-23 15:50:15 +0200
committerDanilo M. <danix@danix.xyz>2026-10-23 15:50:15 +0200
commit246aa68e113f35f87ed985f64abb48cf3d76a23c (patch)
tree3273f8af31f76de176aefe1c23d56d2cad02beb0 /desktop/companion/Companion.qml
parent53d4feafd0cf28da36297942778965d2b22c2811 (diff)
downloadquickshell-246aa68e113f35f87ed985f64abb48cf3d76a23c.tar.gz
quickshell-246aa68e113f35f87ed985f64abb48cf3d76a23c.zip
companion: idle in step with wscreensavers, and despite No lock
Her stages sat at 1, 3 and 5 minutes, and the saver starts at 5, so she lay down under it. They are now 20, 40 and 70% of wscreensavers' idleTimeoutMinutes, read live from its config: 1, 2 and 3.5 minutes at its default. She never idled at all while No lock was on: it holds an idle inhibitor and her monitors respected inhibitors. Measured with a throwaway shell, a 5 s monitor respecting them never fired while one ignoring them did. They now ignore inhibitors, as the saver does, and presentation and gaming mode keep her awake by name. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'desktop/companion/Companion.qml')
-rw-r--r--desktop/companion/Companion.qml34
1 files changed, 27 insertions, 7 deletions
diff --git a/desktop/companion/Companion.qml b/desktop/companion/Companion.qml
index 3abf222..e6d21e2 100644
--- a/desktop/companion/Companion.qml
+++ b/desktop/companion/Companion.qml
@@ -76,13 +76,33 @@ PanelWindow {
property double lastMonologueAt: 0
property bool monologue: false
- // Bored, yawning, lying down at 1, 3 and 5 minutes. Inhibitors count,
- // so presentation mode keeps her awake. enabled is set explicitly: left
- // out, it read false on creation.
- IdleMonitor { id: idle1; enabled: true; respectInhibitors: true; timeout: 60 }
- IdleMonitor { id: idle2; enabled: true; respectInhibitors: true; timeout: 180 }
- IdleMonitor { id: idle3; enabled: true; respectInhibitors: true; timeout: 300 }
- readonly property int idle: idle3.isIdle ? 3 : idle2.isIdle ? 2 : idle1.isIdle ? 1 : 0
+ // Bored, yawning, lying down at 20, 40 and 70% of the wscreensavers idle
+ // timeout, so she has lain down a while before the saver covers her (1,
+ // 2 and 3.5 minutes at its 5). Read live, so a change in its settings
+ // follows; 5 minutes when the file is missing or unreadable.
+ // Inhibitors are ignored, as wscreensavers ignores them: No lock holds
+ // one for as long as it is on, which kept her awake for hours.
+ // Presentation (and gaming) mode keeps her awake instead, by name.
+ // enabled is set explicitly: left out, it read false on creation.
+ FileView {
+ id: saverConf
+ path: Quickshell.env("HOME") + "/.config/wscreensavers/config.json"
+ watchChanges: true
+ onFileChanged: reload()
+ printErrors: false
+ }
+ readonly property int saverIdle: {
+ try {
+ const m = JSON.parse(saverConf.text()).idleTimeoutMinutes;
+ return m > 0 ? m * 60 : 300;
+ } catch (e) {
+ return 300;
+ }
+ }
+ IdleMonitor { id: idle1; enabled: true; respectInhibitors: false; timeout: Math.round(root.saverIdle * 0.2) }
+ IdleMonitor { id: idle2; enabled: true; respectInhibitors: false; timeout: Math.round(root.saverIdle * 0.4) }
+ IdleMonitor { id: idle3; enabled: true; respectInhibitors: false; timeout: Math.round(root.saverIdle * 0.7) }
+ readonly property int idle: Status.presentation ? 0 : idle3.isIdle ? 3 : idle2.isIdle ? 2 : idle1.isIdle ? 1 : 0
property int wasIdle: 0
onIdleChanged: {
const t = Date.now();