aboutsummaryrefslogtreecommitdiffstats
path: root/desktop/companion
diff options
context:
space:
mode:
Diffstat (limited to 'desktop/companion')
-rw-r--r--desktop/companion/Companion.qml34
-rw-r--r--desktop/companion/README.md9
2 files changed, 35 insertions, 8 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();
diff --git a/desktop/companion/README.md b/desktop/companion/README.md
index 45e522d..cfa3ffc 100644
--- a/desktop/companion/README.md
+++ b/desktop/companion/README.md
@@ -50,8 +50,15 @@ frame falls back to its outfit's `base`.
- She only feels the pointer while it is over her: Quickshell has no
global pointer and Hyprland sends no motion events. Hence the 0.6 s
dodge rather than moving away as the pointer approaches.
+- Idle stages are 20, 40 and 70% of wscreensavers' `idleTimeoutMinutes`,
+ read live from its config, so she lies down before the saver starts.
- `IdleMonitor.enabled` read false on creation when left out, so each of
- the three sets it.
+ the three sets it. It also reads false at `Component.onCompleted` even
+ when set, and true a moment later; do not trust that first reading.
+- The monitors ignore inhibitors. No lock holds an idle inhibitor for as
+ long as it is on, and with `respectInhibitors: true` she never idled
+ (measured: a 5 s monitor respecting them never fired, one ignoring them
+ did). Presentation and gaming mode keep her awake by name instead.
- Fullscreen is `lastIpcObject.fullscreen === 2`. Maximised is 1, and
most windows here are maximised.
- The lock screen covers every layer, so locking needs no code.