2026-07-14 20:17:18 -04:00
import QtQuick
import QtQuick . Layouts
import qs . services
import qs . modules . common
import qs . modules . common . widgets
// Idle & sleep — the staged idle projection, exposed honestly.
//
// The governing idea is REFERENCE-EXTRACTION.md's "idle is a transition graph,
// not a timer": the page shows the live stage the shell is actually in, not
// just three timeout knobs pretending idle is linear.
//
// Two honesty constraints drive the layout, and both come straight from the
// extraction's build order (truth before visuals):
//
// 1. The native idle coordinator is OFF by default and stays experimental
// until the Wayland idle-notify is verified on the Pixel compositor.
// While it is off, the dim/lock TIMERS DO NOT RUN — hypridle owns real
// screen-off, and the only transitions that fire are lock-request and
// lock-secure. The page says so instead of implying the timers are live.
//
shell: dock reorder, fullscreen detection fix, idle-power, sessiond, misc shell work
- Dock drag-to-reorder for pinned apps (insertion gap, quick-slide vs dwell)
- Fullscreen detection: scan all windows via HyprlandData.windowList
- IdleCoordinator, GlobalStates, Session.qml updates
- Deploy script, qmldir, settings, wallpaper, visualizer fixes
- sessiond server, memory module updates
Co-Authored-By: Claude <noreply@anthropic.com>
2026-07-22 22:18:20 -04:00
// 2. Settings is a window in the authoritative shell process, so this page
// reads the idle/session singletons directly. It must not spawn `qs ipc`
// children, which can become accidental shell instances when display
// selection is ambiguous.
2026-07-14 20:17:18 -04:00
ContentPage {
id: page
forceWidth: true
shell: dock reorder, fullscreen detection fix, idle-power, sessiond, misc shell work
- Dock drag-to-reorder for pinned apps (insertion gap, quick-slide vs dwell)
- Fullscreen detection: scan all windows via HyprlandData.windowList
- IdleCoordinator, GlobalStates, Session.qml updates
- Deploy script, qmldir, settings, wallpaper, visualizer fixes
- sessiond server, memory module updates
Co-Authored-By: Claude <noreply@anthropic.com>
2026-07-22 22:18:20 -04:00
// --- Live stage readout ----------------------------------------------
2026-07-14 21:39:01 -04:00
// 0 Active · 1 Dimmed · 2 Lock requested · 3 Lock secure ·
// 4 Suspending · 5 Asleep · 6 Waking — the IdleCoordinator.State
shell: dock reorder, fullscreen detection fix, idle-power, sessiond, misc shell work
- Dock drag-to-reorder for pinned apps (insertion gap, quick-slide vs dwell)
- Fullscreen detection: scan all windows via HyprlandData.windowList
- IdleCoordinator, GlobalStates, Session.qml updates
- Deploy script, qmldir, settings, wallpaper, visualizer fixes
- sessiond server, memory module updates
Co-Authored-By: Claude <noreply@anthropic.com>
2026-07-22 22:18:20 -04:00
// enum, read directly from the shell-owned coordinator.
readonly property int liveStage: IdleCoordinator . state
readonly property bool liveNative: IdleCoordinator . nativeEnabled
readonly property bool probeOk: true
readonly property bool sleepInhibitorHeld: SessionEvents . sleepInhibitorHeld
readonly property bool stepUpEnabled: StepUpAuth . grantTtlMs > 0
2026-07-14 20:17:18 -04:00
readonly property var stageNames: [
Translation . tr ( "Active" ) ,
Translation . tr ( "Dimmed" ) ,
Translation . tr ( "Lock requested" ) ,
2026-07-14 21:39:01 -04:00
Translation . tr ( "Lock secure" ) ,
Translation . tr ( "Suspending" ) ,
Translation . tr ( "Asleep" ) ,
Translation . tr ( "Waking" )
2026-07-14 20:17:18 -04:00
]
function stageLabel ( s ) {
return ( s >= 0 && s < stageNames . length ) ? stageNames [ s ] : Translation . tr ( "unknown" ) ;
}
ContentSection {
icon: "motion_sensor_active"
title: Translation . tr ( "Current state" )
RowLayout {
Layout.fillWidth: true
spacing: 12
StyledText {
text: page . probeOk
? Translation . tr ( "Idle stage: %1" ) . arg ( page . stageLabel ( page . liveStage ) )
: Translation . tr ( "Idle stage: (shell not reachable)" )
font.pixelSize: Appearance . font . pixelSize . normal
}
}
StyledText {
Layout.fillWidth: true
wrapMode: Text . WordWrap
color: Appearance . colors . colSubtext
font.pixelSize: Appearance . font . pixelSize . smaller
text: page . liveNative
? Translation . tr ( "The native coordinator is driving idle transitions. Dim and lock fire on the timers below." )
: Translation . tr ( "The native coordinator is off, so the timers below do not run — hypridle owns screen-off. Only lock-requested and lock-secure transitions are reported here." )
}
2026-07-14 21:39:01 -04:00
RowLayout {
Layout.fillWidth: true
spacing: 12
StyledText {
text: page . sleepInhibitorHeld
? Translation . tr ( "Sleep inhibitor: held (suspend blocked until lock is secure)" )
: Translation . tr ( "Sleep inhibitor: released (suspend may proceed)" )
font.pixelSize: Appearance . font . pixelSize . normal
color: page . sleepInhibitorHeld
? Appearance . colors . colOnLayer1
: Appearance . colors . colSubtext
}
}
}
2026-07-14 20:17:18 -04:00
ContentSection {
icon: "experiment"
title: Translation . tr ( "Native idle coordinator" )
ConfigSwitch {
buttonIcon: "science"
text: Translation . tr ( "Enable native coordinator (experimental)" )
checked: Config . options . lock . idle . nativeCoordinatorEnabled
onCheckedChanged: {
Config . options . lock . idle . nativeCoordinatorEnabled = checked ;
}
StyledToolTip {
text: Translation . tr ( "Use Wayland idle-notify to drive the dim/lock timers. Unverified on the Pixel 3 compositor build — leave off unless you are testing it. When off, hypridle handles idle and screen-off." )
}
}
}
ContentSection {
icon: "timer"
title: Translation . tr ( "Timers" )
// These write real Config keys, but they only take EFFECT when the
// native coordinator is on. Disabled (greyed) otherwise so the page
// never implies a knob is doing something it isn't.
ConfigSpinBox {
icon: "brightness_low"
text: Translation . tr ( "Dim after (seconds)" )
value: Config . options . lock . idle . dimAfterSeconds
from: 5
to: 600
stepSize: 5
enabled: Config . options . lock . idle . nativeCoordinatorEnabled
onValueChanged: Config . options . lock . idle . dimAfterSeconds = value
StyledToolTip {
text: Translation . tr ( "Seconds of inactivity before the screen dims. Only active while the native coordinator is enabled." )
}
}
ConfigSpinBox {
icon: "lock_clock"
text: Translation . tr ( "Lock after (seconds)" )
value: Config . options . lock . idle . lockAfterSeconds
from: 10
to: 1800
stepSize: 10
enabled: Config . options . lock . idle . nativeCoordinatorEnabled
onValueChanged: Config . options . lock . idle . lockAfterSeconds = value
StyledToolTip {
text: Translation . tr ( "Seconds of inactivity before the session locks. Only active while the native coordinator is enabled." )
}
}
}
}