Skip to content
Open
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 12 additions & 10 deletions shell/plugins/menu/Menu.qml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,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)

Comment on lines +27 to +34
if (payload.fontFamily) root.fontFamily = payload.fontFamily

if (payload.mode === "select" || payload.mode === "input") {
Expand Down Expand Up @@ -90,8 +98,6 @@ Item {
onFilterTextChanged: if (filterInput.text !== filterText) filterInput.text = filterText
property int selectedIndex: 0
property bool cursorActive: false
Comment thread
greptile-apps[bot] marked this conversation as resolved.
Resolved
property int requestSerial: 0
property int applySerial: 0
property var items: ({})
Comment on lines 116 to 117

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Keybindings no longer run

Removing applySerial breaks choosing a row in the keybindings menu. activateIndex() still runs applySerial = requestSerial before closing the menu or running the chosen command. Assigning to that undeclared name raises a QML error, so clicking a row or pressing Enter leaves the menu open and does nothing.

Remove the leftover assignment along with the unused resultProc, or restore the property.

property var itemOrder: []
property var navStack: []
Expand Down Expand Up @@ -150,12 +156,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) {
Expand Down Expand Up @@ -883,7 +890,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)
Expand Down Expand Up @@ -919,7 +925,6 @@ Item {
}

function applyDmenuSelection(value) {
applySerial = requestSerial
opened = false
filterText = ""
root.finishRequest(value)
Expand All @@ -928,7 +933,6 @@ Item {
function applySelected(id, action) {
if (!id) { cancel(); return }

applySerial = requestSerial
opened = false
filterText = ""
root.runAction(action)
Expand All @@ -941,7 +945,6 @@ Item {
}

function openExistingMenu(initialMenu) {
requestSerial += 1
mode = "menu"
requestActive = false
selectionFile = ""
Expand All @@ -965,7 +968,6 @@ Item {
}

function openDmenu(payload) {
requestSerial += 1
mode = payload.mode === "input" ? "input" : "select"
dmenuPrompt = String(payload.prompt || (mode === "input" ? Commons.I18n.t("menu.inputPrompt") : Commons.I18n.t("menu.selectPrompt")))
dmenuOptions = Array.isArray(payload.options) ? payload.options : []
Expand Down