fix(nosignal): F-sudo focus via hyprctl (stayfocused invalid in Hypr 0.55)
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) <noreply@anthropic.com>
This commit is contained in:
parent
e42538896f
commit
0ae8593113
1 changed files with 28 additions and 2 deletions
|
|
@ -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 {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue