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:
parent
e10efbbd56
commit
9254333fcc
2 changed files with 25 additions and 21 deletions
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
|
|
|||
Loading…
Reference in a new issue