quickshell: fix the trace hiding the event it was added to catch

The rawEvent gate keyed off launcherPanel.open, but the focus-grab clear
sets open=false before Hyprland's IPC event arrives, so the compositor
event around each clear was filtered out — the log came back empty. Key
off a timestamp instead, and report who holds focus when the grab clears.
This commit is contained in:
rope 2026-08-01 20:58:18 +01:00
parent b57c06da5e
commit a040997551

View file

@ -1531,6 +1531,13 @@ in
// Non-empty when the query parses as arithmetic.
property string calcResult: ""
// Diagnostic clock (ms since the last toggle). Deliberately
// NOT `open`-gated: the first version of the compositor trace
// keyed off `open`, and the focus-grab clear sets open=false
// before Hyprland's IPC event arrives, so it hid the one
// event worth seeing.
property double traceFrom: 0
readonly property var catDefs: [
{ key: "All", label: "All apps", icon: "layout-grid" },
{ key: "Network", label: "Internet", icon: "globe" },
@ -1572,6 +1579,7 @@ in
// from "Super+R never arrived": if the journal shows
// `-> open` with no matching focusgrab line after it,
// the panel really did open and something drew over it.
traceFrom = Date.now();
console.log("launcher toggle -> " + (open ? "open" : "closed"));
if (open) {
searchInput.text = "";
@ -2948,9 +2956,17 @@ in
// hyprland.nix exists for), and only the timing tells
// them apart a clear within a few ms of the toggle
// above was not a human clicking.
if (launcherPanel.open || bar.activeDropdown !== null)
console.log("focusgrab cleared: closing launcher="
+ launcherPanel.open + " dropdown=" + (bar.activeDropdown !== null));
if (launcherPanel.open || bar.activeDropdown !== null) {
// Who holds focus at clear time is the whole
// question: a competitor that stole it back, or
// nothing at all (a grab the compositor refused).
const top = Hyprland.activeToplevel;
const cls = top && top.lastIpcObject ? top.lastIpcObject["class"] : "?";
console.log("focusgrab cleared +" + (Date.now() - launcherPanel.traceFrom)
+ "ms: launcher=" + launcherPanel.open
+ " dropdown=" + (bar.activeDropdown !== null)
+ " focus=" + (top ? cls + " / " + top.title : "none"));
}
launcherPanel.open = false;
bar.closeAllDropdowns();
}
@ -2966,8 +2982,9 @@ in
Connections {
target: Hyprland
function onRawEvent(event) {
if (launcherPanel.open || bar.activeDropdown !== null)
console.log("hypr event: " + event.name + " | " + event.data);
const dt = Date.now() - launcherPanel.traceFrom;
if (dt < 3000)
console.log("hypr event +" + dt + "ms: " + event.name + " | " + event.data);
}
}