From f280c8171cfe9c40fabe5aa6ed3fd4f13e5f9b21 Mon Sep 17 00:00:00 2001 From: "Danilo M." Date: Sat, 26 Sep 2026 12:36:49 +0200 Subject: fix(assistant): retry the event socket with a fresh Socket Quickshell 0.3.1 keeps the QLocalSocket of a failed connect, so setting connected = true again never retries: an overlay started before the assistant (at login, or by a restart) stayed dark for good. The Socket now lives in a LazyLoader that the retry timer turns off and on. Co-Authored-By: Claude Opus 5.5 --- AGENTS.md | 7 +++++++ assistant/Assistant.qml | 24 +++++++++++++++--------- 2 files changed, 22 insertions(+), 9 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index b4e6136..1b15ec8 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -246,6 +246,13 @@ changing that component. The ones that generalise: - **The old waybar notification module shelled out to `dunstctl`.** It and its `notifications.py` are archived under `~/bin/archive/`, with the rest of the stock waybar theme; do not resurrect them. +- **A `Socket` whose connect failed never retries.** Quickshell 0.3.1 keeps + the failed `QLocalSocket`, so setting `connected = true` again (or toggling + it, or changing `path`) is a no-op: `setConnected` only connects when no + socket object exists. Retry with a fresh `Socket`, e.g. inside a + `LazyLoader` toggled off and on (`assistant/Assistant.qml`). A dropped + connection is different: `disconnected` clears the socket, so a later + `connected = true` works, until one of those attempts fails. ## Theme diff --git a/assistant/Assistant.qml b/assistant/Assistant.qml index 4117882..6d1eeb2 100644 --- a/assistant/Assistant.qml +++ b/assistant/Assistant.qml @@ -89,20 +89,26 @@ Scope { onTriggered: root.shown = false } - Socket { - id: sock - path: `${Quickshell.env("XDG_RUNTIME_DIR") || "/tmp"}/desktop-assistant.sock` - connected: true - onConnectionStateChanged: if (!connected) root.shown = false - parser: SplitParser { onRead: line => root.handle(line) } + // The assistant may start after this shell, or restart: keep trying with + // a fresh Socket each time. Quickshell 0.3.1 keeps the QLocalSocket of a + // failed connect, so setting `connected` again on the same Socket never + // retries: an overlay started before the assistant stayed dark for good. + LazyLoader { + id: link + active: true + Socket { + path: `${Quickshell.env("XDG_RUNTIME_DIR") || "/tmp"}/desktop-assistant.sock` + connected: true + onConnectionStateChanged: if (!connected) root.shown = false + parser: SplitParser { onRead: line => root.handle(line) } + } } - // The assistant may start after this shell, or restart: keep trying. Timer { interval: 2000 repeat: true - running: !sock.connected - onTriggered: sock.connected = true + running: !(link.item?.connected ?? false) + onTriggered: { link.active = false; link.active = true; } } // A config with no visible window exits, reporting nothing. This 1x1 -- cgit v1.2.3