diff --git a/shell/plugins/menu/Menu.qml b/shell/plugins/menu/Menu.qml index 0e609882aa2b..7476f6907257 100644 --- a/shell/plugins/menu/Menu.qml +++ b/shell/plugins/menu/Menu.qml @@ -24,6 +24,14 @@ Item { var payload = ({}) try { payload = JSON.parse(payloadJson || "{}") } catch (e) { payload = ({}) } + // A select/input request left in flight when a new summon arrives + // (e.g. the trigger key repeated before the prior one was answered) + // would otherwise have its doneFile silently abandoned by + // openDmenu/openExistingMenu below, leaving the caller that's still + // polling for it (bin/omarchy-menu-select) blocked forever. Answer it + // as cancelled first so every summon always resolves. + if (root.requestActive) root.finishRequest(null) + if (payload.fontFamily) root.fontFamily = payload.fontFamily // A shell that started mid-update may never have read the shipped menu // whole; reading it again here keeps the menu from opening empty. @@ -106,7 +114,6 @@ Item { // Rows with a `alt:` stand-in show and run it while this holds. property bool altHeld: false property int requestSerial: 0 - property int applySerial: 0 property var items: ({}) property var itemOrder: [] property var navStack: [] @@ -168,12 +175,13 @@ Item { root.selectionFile = "" root.doneFile = "" + // Each answer gets its own process: a shared Process drops a command set + // while it is still running, which strands the caller waiting on it. if (selection === null || selection === undefined) { - resultProc.command = ["bash", "-c", ": > " + Util.shellQuote(activeDoneFile)] + Quickshell.execDetached(["bash", "-c", ": > " + Util.shellQuote(activeDoneFile)]) } else { - resultProc.command = ["bash", "-c", "printf '%s\\n' " + Util.shellQuote(selection) + " > " + Util.shellQuote(activeSelectionFile) + "; : > " + Util.shellQuote(activeDoneFile)] + Quickshell.execDetached(["bash", "-c", "printf '%s\\n' " + Util.shellQuote(selection) + " > " + Util.shellQuote(activeSelectionFile) + "; : > " + Util.shellQuote(activeDoneFile)]) } - resultProc.running = true } function runAction(action) { @@ -950,7 +958,6 @@ Item { } else if (row.kind === "app") { var appId = row.appId var label = row.label - applySerial = requestSerial opened = false filterText = "" if (root.appLibrary) root.appLibrary.launch(appId, label) @@ -996,7 +1003,6 @@ Item { } function applyDmenuSelection(value) { - applySerial = requestSerial opened = false filterText = "" root.finishRequest(value) @@ -1005,7 +1011,6 @@ Item { function applySelected(id, action) { if (!id) { cancel(); return } - applySerial = requestSerial opened = false filterText = "" root.runAction(action)