From 0ae859311310661555dae089c91f2c0bfaaec10b Mon Sep 17 00:00:00 2001 From: 28allday Date: Sat, 20 Jun 2026 19:26:30 +0100 Subject: [PATCH] fix(nosignal): F-sudo focus via hyprctl (stayfocused invalid in Hypr 0.55) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit VM-cert of round 4 surfaced a Hyprland config-error banner: the shipped `windowrule = stayfocused on, match:class nosignal-sudo` is rejected at parse time — `stayfocused` is not a valid field in Hyprland 0.55's match: windowrule grammar (only float/center/pin/size are). The line was skipped, so the prompt never got the focus rule and an error banner showed on every boot. Replace it: keep the dedicated nosignal-sudo class (float/center/pin/size, all valid — set in the builder) and pull keyboard focus to the prompt from here via `hyprctl dispatch focuswindow class:^(nosignal-sudo)$` (the handover's "or activate it" option), nudged a few times to cover terminal startup. Co-Authored-By: Claude Opus 4.8 (1M context) --- modules/nexus/common/SudoToggleRow.qml | 30 ++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/modules/nexus/common/SudoToggleRow.qml b/modules/nexus/common/SudoToggleRow.qml index 3646beda..6758ceff 100644 --- a/modules/nexus/common/SudoToggleRow.qml +++ b/modules/nexus/common/SudoToggleRow.qml @@ -22,10 +22,13 @@ ToggleRow { : qsTr("Run sudo without a password for 15 minutes, then it reverts") onToggled: { - if (checked) + if (checked) { enableProc.running = true; // needs a password -> floating terminal - else + focusTimer.ticks = 0; + focusTimer.restart(); // then pull keyboard focus to the prompt + } else { disableProc.running = true; // no password inside the active window + } reconcile.restart(); } @@ -59,6 +62,29 @@ ToggleRow { id: disableProc command: ["sudo", "-n", "nosignal-sudo-toggle", "disable"] } + // Force keyboard focus onto the password prompt once it has mapped. Hyprland + // 0.55's match: windowrule grammar has no working `stayfocused`, so we + // "activate it" from here instead (the prompt uses the dedicated nosignal-sudo + // class). Two nudges cover slow terminal startup. + Process { + id: focusProc + command: ["hyprctl", "dispatch", "focuswindow", "class:^(nosignal-sudo)$"] + } + Timer { + id: focusTimer + interval: 400 + repeat: true + triggeredOnStart: false + property int ticks: 0 + onTriggered: { + focusProc.running = true; + ticks += 1; + if (ticks >= 3) { + ticks = 0; + stop(); + } + } + } // --- polling -------------------------------------------------------------- Timer {