Watch
1
0
Fork
You've already forked souveraine
0

sessiond: double-tap-to-wake wakes, and the volume keys work again

Two things that worked under Hyprland and stopped when viewtop took the
session, both for the same reason: the binding lived in hyprland.lua and
the daemon was never in the path.

dt2w: note_input recorded the wake and returned Restore, which is
brightness. So a double tap reported to the machine and the screen stayed
dark. It now returns Unblank first — the brightness a panel comes back at
means nothing until the panel is back. Only for the deliberate wakes
(DoubleTapToWake, Squeeze) and only when the panel is actually dark. The
power button is excluded on purpose: apply_gesture already wakes on its
resolved tap, and emitting a second unblank here is precisely how the
wake loop happened in the compositor this afternoon.

Volume: Action::Volume through the executor table, per §12 — a small
daemon reading a signal and calling wpctl is the eighth blind actor. It
fires on the DOWN edge rather than from a recognised gesture, because
BUTTON_MULTI_TAP_WINDOW is 300ms and a volume key that lags a third of a
second behind the press feels broken. The recogniser still sees the
edges, so a future binding table gets volume hold-to-ramp without this
changing.

Shell: HyprlandData did a bare JSON.parse on hyprctl output, which throws
on every refresh when there is no hyprctl — six exceptions a pass, and
every consumer of monitorData.scale got undefined. That is why the region
selector rendered as a sliver: the geometry was not wrong, it was NaN.
Absence is now a latched state, and RegionSelection/OverviewWidget fall
back to screen.devicePixelRatio. Hyprland stays preferred where it exists.

105 tests.
This commit is contained in:
Fimeg 2026-08-02 18:28:49 -04:00
commit 266af98a99
6 changed files with 282 additions and 54 deletions

View file

@ -38,7 +38,8 @@ Item {
property real smallWorkspaceRadius: Appearance.rounding.verysmall
property real workspaceNumberMargin: 80
property real workspaceNumberSize: 250 * monitor.scale
property real monitorScale: (monitor?.scale ?? 0) > 0 ? monitor.scale : (screen?.devicePixelRatio ?? 1)
property real workspaceNumberSize: 250 * monitorScale
property int workspaceZ: 0
property int windowZ: 1
property int windowDraggingZ: 99999

View file

@ -77,11 +77,27 @@ PanelWindow {
readonly property real falsePositivePreventionRatio: 0.5
// Screen & interaction vars
// Monitor geometry, from Wayland when Hyprland is not the compositor.
//
// `Hyprland.monitorFor()` returns null under viewtop there is no
// Hyprland IPC to ask so `monitorScale` was `undefined` and every region
// below multiplies by it. `undefined * n` is NaN, which is why the
// selector rendered as a sliver of pixels rather than a rectangle:
// the geometry was not wrong, it was not a number.
//
// `screen` is quickshell's own `ShellScreen` and is always there, on any
// compositor. Hyprland stays the preferred source where it exists (the
// laptop), because it also carries workspace and multi-monitor offsets
// that Wayland does not hand a client but it is no longer the only one.
// SHELL-SURFACES.md's rule: a feature defined against a substrate dies
// with that substrate; one defined against a contract survives.
readonly property HyprlandMonitor hyprlandMonitor: Hyprland.monitorFor(screen)
readonly property real monitorScale: hyprlandMonitor.scale
readonly property real monitorOffsetX: hyprlandMonitor.x
readonly property real monitorOffsetY: hyprlandMonitor.y
property int activeWorkspaceId: hyprlandMonitor.activeWorkspace?.id ?? 0
readonly property real monitorScale: (hyprlandMonitor?.scale ?? 0) > 0
? hyprlandMonitor.scale
: (screen?.devicePixelRatio ?? 1)
readonly property real monitorOffsetX: hyprlandMonitor?.x ?? screen?.x ?? 0
readonly property real monitorOffsetY: hyprlandMonitor?.y ?? screen?.y ?? 0
property int activeWorkspaceId: hyprlandMonitor?.activeWorkspace?.id ?? 0
property string screenshotPath: `${root.screenshotDir}/image-${screen.name}`
property real dragStartX: 0
property real dragStartY: 0

View file

@ -21,6 +21,53 @@ Singleton {
property var activeWorkspace: null
property var activeWindow: null
property var monitors: []
// Parse hyprctl's JSON, or keep what we had.
//
// Every collector below did a bare `JSON.parse()` on the process output.
// That is fine while Hyprland is the compositor and a hard error the
// moment it is not: under viewtop there is no `hyprctl`, the output is
// empty, and each collector threw a SyntaxError on every refresh six
// exceptions per pass, forever, drowning the log the shell is diagnosed
// from.
//
// Absence is a state, not a failure. `HYPRLAND_INSTANCE_SIGNATURE` unset
// means "another compositor", and the honest answer is to keep the last
// known value and say so once the same distinction
// DEVICE-STATE-MACHINE.md §10 draws between "no evidence" and "evidence
// says nothing".
property bool available: true
function parseOrKeep(text, fallback, what) {
if (!text || text.trim().length === 0) {
if (root.available) {
root.available = false;
console.log("[HyprlandData] no hyprctl output for", what,
"— assuming another compositor; monitor geometry comes from `screen`");
}
return fallback;
}
try {
const parsed = JSON.parse(text);
if (!root.available) {
root.available = true;
console.log("[HyprlandData] hyprctl is answering again");
}
return parsed;
} catch (e) {
// Latched like the empty case: `hyprctl` missing does not always
// mean *empty* output a shell that prints an error to stdout
// lands here instead, and it lands here on every refresh. One line
// per edge, not four per pass. Same rule §10 applies to a sensor
// that has gone quiet: say it when it changes, not when it repeats.
if (root.available) {
root.available = false;
console.log("[HyprlandData]", what, "is unparseable —",
"assuming another compositor; monitor geometry comes from `screen`:", e);
}
return fallback;
}
}
property var layers: ({})
// Convenient stuff
@ -101,7 +148,7 @@ Singleton {
stdout: StdioCollector {
id: clientsCollector
onStreamFinished: {
root.windowList = JSON.parse(clientsCollector.text)
root.windowList = root.parseOrKeep(clientsCollector.text, [], "data")
let tempWinByAddress = {};
for (var i = 0; i < root.windowList.length; ++i) {
var win = root.windowList[i];
@ -119,7 +166,7 @@ Singleton {
stdout: StdioCollector {
id: activeWindowCollector
onStreamFinished: {
root.activeWindow = JSON.parse(activeWindowCollector.text)
root.activeWindow = root.parseOrKeep(activeWindowCollector.text, root.activeWindow, "activewindow")
}
}
}
@ -130,7 +177,7 @@ Singleton {
stdout: StdioCollector {
id: monitorsCollector
onStreamFinished: {
root.monitors = JSON.parse(monitorsCollector.text);
root.monitors = root.parseOrKeep(monitorsCollector.text, root.monitors, "monitors");
}
}
}
@ -141,7 +188,7 @@ Singleton {
stdout: StdioCollector {
id: layersCollector
onStreamFinished: {
root.layers = JSON.parse(layersCollector.text);
root.layers = root.parseOrKeep(layersCollector.text, root.layers, "layers");
}
}
}
@ -152,7 +199,7 @@ Singleton {
stdout: StdioCollector {
id: workspacesCollector
onStreamFinished: {
var rawWorkspaces = JSON.parse(workspacesCollector.text);
var rawWorkspaces = root.parseOrKeep(workspacesCollector.text, root.workspaces, "workspaces");
// Filter out invalid workspace ids (e.g. lock-screen temp workspace 2147483647 - N)
root.workspaces = rawWorkspaces.filter(ws => ws.id >= 1 && ws.id <= 100);
let tempWorkspaceById = {};
@ -172,7 +219,7 @@ Singleton {
stdout: StdioCollector {
id: activeWorkspaceCollector
onStreamFinished: {
root.activeWorkspace = JSON.parse(activeWorkspaceCollector.text);
root.activeWorkspace = root.parseOrKeep(activeWorkspaceCollector.text, root.activeWorkspace, "activeworkspace");
}
}
}

View file

@ -114,6 +114,43 @@ Singleton {
if (root.hasLoginctl)
lockedHintProc.report(root.locked);
}
// The seat's session object path, resolved once.
//
// `report()` used to resolve it on every call, which meant `sh` plus two
// busctl round trips before the hint could move. Measured 2026-08-02: the
// hint landed *after* sessiond's 2 s `LOCK_ACK_BUDGET`, so `request_blank()`
// timed out and blanked unlocked even though every other link in the chain
// was by then correct. Resolving once turns the lock report into a single
// call.
//
// Safe to cache for this shell's lifetime: the seat's session only changes
// when greetd restarts, and that restarts the shell with it.
property string seatSessionPath: ""
Process {
id: seatPathProbe
running: true
command: ["sh", "-c",
"busctl get-property org.freedesktop.login1 " +
"/org/freedesktop/login1/seat/seat0 " +
"org.freedesktop.login1.Seat ActiveSession " +
"| grep -o '/org/freedesktop/login1/session/[^\"]*' " +
"|| busctl get-property org.freedesktop.login1 " +
"/org/freedesktop/login1/user/_$(id -u) " +
"org.freedesktop.login1.User Display " +
"| grep -o '/org/freedesktop/login1/session/[^\"]*'"]
stdout: StdioCollector {
onStreamFinished: {
root.seatSessionPath = text.trim();
console.log("[session] seat session path:", root.seatSessionPath);
// Replay: the lock may already be secure by the time this
// lands, and the edge that would have reported it is gone.
// Same fault `onHasLoginctlChanged` above exists to fix.
if (root.seatSessionPath !== "" && root.hasLoginctl)
lockedHintProc.report(root.locked);
}
}
}
Process {
id: lockedHintProc
property bool pending: false
@ -125,49 +162,22 @@ Singleton {
pendingValue = value;
return;
}
// Resolve the session the way `lockhint.rs` does the user's
// Display session and never through the `/session/auto` alias.
//
// `auto` means *the caller's own* session, and the shell is not in
// the session that owns the seat. Measured 2026-08-02: viewtop in
// logind session 66 (seat0, tty1, the one `User.Display` names and
// the one sessiond watches), `qs -c souveraine` in session 70. So
// this call was setting the hint on a session nobody reads, while
// the graphical session's `LockedHint` stayed `no` forever.
//
// The consequence was not cosmetic. sessiond takes `locked` from
// `LockedHint` (doctrine §4), so `locked` was permanently false;
// `request_blank()` therefore timed out its `LOCK_ACK_BUDGET` on
// every single blank and took the fail-open branch, darkening the
// panel on a session it could not confirm was locked and writing
// `blank-without-lock` each time. LOCK-DPMS-LESSONS §1's ordering
// held in the code and not on the device.
//
// One shell round trip rather than two Processes: the path has to
// be resolved at report time, because the session id changes across
// a greetd restart and a cached one would be stale exactly when it
// matters. `$()` is fine here the value is a busctl-printed
// object path, not user input.
// The seat's active session the one on the glass with
// `User.Display` only as a fallback. `lockhint.rs` resolves the
// same way on the read side, and the two must agree or this writes
// a hint nobody reads. An ssh login is enough to make `Display`
// name a seatless remote session, which is exactly how this was
// found.
command = ["sh", "-c",
"p=$(busctl get-property org.freedesktop.login1 " +
"/org/freedesktop/login1/seat/seat0 " +
"org.freedesktop.login1.Seat ActiveSession " +
"| grep -o '/org/freedesktop/login1/session/[^\"]*'); " +
"[ -n \"$p\" ] || p=$(busctl get-property " +
"org.freedesktop.login1 " +
"/org/freedesktop/login1/user/_$(id -u) " +
"org.freedesktop.login1.User Display " +
"| grep -o '/org/freedesktop/login1/session/[^\"]*'); " +
"[ -n \"$p\" ] || exit 1; " +
"exec busctl call org.freedesktop.login1 \"$p\" " +
"org.freedesktop.login1.Session SetLockedHint b " +
(value ? "true" : "false")];
if (root.seatSessionPath === "") {
// The probe has not landed. Dropping here is safe only because
// the probe replays on completion see its onStreamFinished.
return;
}
// Never `/session/auto`: that is the *caller's* session, and the
// shell is not in the one that owns the seat. Measured: viewtop in
// logind 66 (seat0/tty1), `qs` in 70 the hint was being written to
// a session nobody reads while the graphical session stayed `no`
// forever. sessiond takes `locked` from `LockedHint` (doctrine §4),
// so that made `locked` permanently false and every blank went out
// on a session nobody could confirm was locked.
command = ["busctl", "call", "org.freedesktop.login1",
root.seatSessionPath,
"org.freedesktop.login1.Session",
"SetLockedHint", "b", value ? "true" : "false"];
running = true;
}
onExited: {