Watch
1
0
Fork
You've already forked souveraine
0

sessiond bridge: use connectionStateChanged, fix lock card imports

The shell refused to load on the phone — onSocketConnected/
onSocketDisconnected handler-slots aren't reliably attachable across
quickshell builds, so the whole singleton cascade aborted at the bridge.
Switched to the real connectionStateChanged signal, branching on
sock.connected. LockAgentCard needs 'import qs' for the GlobalStates
singleton (root module), not just qs.services.
This commit is contained in:
Fimeg 2026-07-16 21:32:43 -04:00
commit 9254333fcc
2 changed files with 25 additions and 21 deletions

View file

@ -6,6 +6,7 @@
// output is safe on the lock surface; personal is not).
import QtQuick
import QtQuick.Layouts
import qs
import qs.services
Item {

View file

@ -87,29 +87,32 @@ Singleton {
path: Quickshell.env("XDG_RUNTIME_DIR") + "/souveraine/sessiond.sock"
connected: true
onSocketConnected: {
console.log("[sessiond-bridge] connected");
// A fresh connection is never registered yet. If we were
// registered before (sessiond restarted underneath us),
// re-register right away so the heartbeat resumes.
const wasRegistered = root.registered;
root.registered = false;
root.ackSent = false;
if (wasRegistered) {
root.shellReady(function(mustLock) {
if (mustLock) {
// sessiond locked while we were disconnected (it
// treats our EOF as shell death). Mirror it.
GlobalStates.screenLocked = true;
}
});
// `connectionStateChanged` is the real Signal on Quickshell.Io.Socket;
// the `onSocketConnected`/`onSocketDisconnected` handler-slots aren't
// reliably attachable across quickshell builds, so branch on
// `connected` here. Re-register on reconnect if we were registered
// before (sessiond restarted underneath us).
onConnectionStateChanged: {
if (sock.connected) {
console.log("[sessiond-bridge] connected");
const wasRegistered = root.registered;
root.registered = false;
root.ackSent = false;
if (wasRegistered) {
root.shellReady(function(mustLock) {
if (mustLock) {
// sessiond locked while we were disconnected (it
// treats our EOF as shell death). Mirror it.
GlobalStates.screenLocked = true;
}
});
}
} else {
console.log("[sessiond-bridge] disconnected");
root.registered = false;
root.pendingReady = null;
}
}
onSocketDisconnected: {
console.log("[sessiond-bridge] disconnected");
root.registered = false;
root.pendingReady = null;
}
parser: SplitParser {
splitMarker: "\n"