From a98f74d5b08ffced2a4bc61b8924b851a525f067 Mon Sep 17 00:00:00 2001 From: wiko de la rosa Date: Sat, 22 Aug 2026 18:26:56 -0400 Subject: [PATCH 1/6] Finish superseded menu-select requests so their waiters exit --- shell/plugins/menu/Menu.qml | 6 + .../fixtures/menu-select-supersede/shell.qml | 115 ++++++++++++++++++ test/shell.d/menu-select-supersede-test.sh | 87 +++++++++++++ 3 files changed, 208 insertions(+) create mode 100644 test/shell.d/fixtures/menu-select-supersede/shell.qml create mode 100755 test/shell.d/menu-select-supersede-test.sh diff --git a/shell/plugins/menu/Menu.qml b/shell/plugins/menu/Menu.qml index eeaf2e25ca11..bf9b2eacb6b0 100644 --- a/shell/plugins/menu/Menu.qml +++ b/shell/plugins/menu/Menu.qml @@ -835,6 +835,9 @@ Item { } function openExistingMenu(initialMenu) { + // Taking the surface over must not drop a live select/input request: + // its waiter polls the done file forever once these handles are cleared. + root.finishRequest(null) requestSerial += 1 mode = "menu" requestActive = false @@ -859,6 +862,9 @@ Item { } function openDmenu(payload) { + // Same contract as openExistingMenu: a request displaced by a newer one + // still gets its done file written, or the waiting script never exits. + root.finishRequest(null) requestSerial += 1 mode = payload.mode === "input" ? "input" : "select" dmenuPrompt = String(payload.prompt || (mode === "input" ? "Input" : "Select")) diff --git a/test/shell.d/fixtures/menu-select-supersede/shell.qml b/test/shell.d/fixtures/menu-select-supersede/shell.qml new file mode 100644 index 000000000000..ec6e394496b3 --- /dev/null +++ b/test/shell.d/fixtures/menu-select-supersede/shell.qml @@ -0,0 +1,115 @@ +import QtQuick +import Quickshell + +// Drives the REAL shell/plugins/menu/Menu.qml through the two supersede paths +// that strand a waiting omarchy-menu-select: opening the regular menu over an +// active select request, and opening a new select request over another one. +// The bash runner asserts afterwards that every displaced request had its done +// file written, which is what lets the waiting script exit. +ShellRoot { + id: root + + readonly property string resultPath: Quickshell.env("OMARCHY_QML_TEST_RESULT") + readonly property string scratchDir: Quickshell.env("OMARCHY_MENU_TMP") + property var menu: null + property var failures: [] + + function fail(message) { + failures.push(String(message)) + } + + function assertTrue(condition, message) { + if (!condition) fail(message) + } + + function shellQuote(value) { + return "'" + String(value).replace(/'/g, "'\\''") + "'" + } + + function writeResult() { + var payload = JSON.stringify({ + ok: failures.length === 0, + failures: failures + }) + + if (resultPath) { + Quickshell.execDetached(["bash", "-lc", "printf '%s' " + shellQuote(payload) + " > " + shellQuote(resultPath)]) + } + } + + function selectPayload(prompt, name) { + return JSON.stringify({ + mode: "select", + prompt: prompt, + options: ["alpha", "bravo"], + selectionFile: scratchDir + "/sel-" + name, + doneFile: scratchDir + "/done-" + name + }) + } + + Timer { + id: driver + interval: 100 + repeat: true + running: true + property int tick: 0 + + onTriggered: { + try { + tick += 1 + + if (tick === 1) { + var component = Qt.createComponent("file://" + Quickshell.env("OMARCHY_PATH") + "/shell/plugins/menu/Menu.qml", Component.PreferSynchronous) + if (component.status !== Component.Ready) { + root.fail("Menu.qml failed to load: " + component.errorString()) + root.finish() + return + } + root.menu = component.createObject(null) + if (!root.menu) { + root.fail("Menu.qml failed to instantiate") + root.finish() + return + } + } + + // Scenario A: a live select request is superseded by the regular menu. + if (tick === 3) { + root.menu.open(root.selectPayload("A", "a")) + root.assertTrue(root.menu.requestActive === true, "select A becomes the active request") + root.assertTrue(root.menu.dmenuActive === true, "select A puts the menu into dmenu mode") + root.menu.openExistingMenu("root") + root.assertTrue(root.menu.mode === "menu", "the regular menu takes over from select A") + } + + // Scenario B: a live select request is superseded by another select. + if (tick === 12) { + root.menu.open(root.selectPayload("B", "b")) + root.assertTrue(root.menu.requestActive === true, "select B becomes the active request") + root.menu.open(root.selectPayload("C", "c")) + root.assertTrue(root.menu.doneFile === root.scratchDir + "/done-c", "select C holds the live request afterwards") + } + + if (tick === 20) root.finish() + } catch (error) { + root.fail("menu supersede fixture threw: " + error) + root.finish() + } + } + } + + function finish() { + driver.running = false + // Result first, quit later: execDetached spawns asynchronously, and an + // immediate Qt.quit() can win the race and leave the result unwritten. + root.writeResult() + quitDelay.restart() + } + + Timer { + id: quitDelay + interval: 500 + repeat: false + onTriggered: Qt.quit() + } +} diff --git a/test/shell.d/menu-select-supersede-test.sh b/test/shell.d/menu-select-supersede-test.sh new file mode 100755 index 000000000000..c6a53a25f730 --- /dev/null +++ b/test/shell.d/menu-select-supersede-test.sh @@ -0,0 +1,87 @@ +#!/bin/bash + +set -euo pipefail + +source "$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)/base-test.sh" + +TMPDIR="" +QS_PID="" + +cleanup() { + if [[ -n $QS_PID ]] && kill -0 "$QS_PID" 2>/dev/null; then + kill "$QS_PID" 2>/dev/null || true + wait "$QS_PID" 2>/dev/null || true + fi + if [[ -n $TMPDIR && -d $TMPDIR ]]; then + rm -rf "$TMPDIR" + fi +} +trap cleanup EXIT + +require_compositor "menu select supersede test" + +if ! command -v quickshell >/dev/null 2>&1; then + pass "quickshell not installed; skipping menu select supersede test" + exit 0 +fi + +require_command jq + +TMPDIR=$(mktemp -d) +result="$TMPDIR/result.json" +log="$TMPDIR/quickshell.log" +scratch="$TMPDIR/scratch" +config_dir="$TMPDIR/menu-select-supersede" +mkdir -p "$config_dir" "$scratch" +cp "$SHELL_TEST_DIR/fixtures/menu-select-supersede/shell.qml" "$config_dir/shell.qml" +ln -s "$ROOT/shell/Ui" "$config_dir/Ui" +ln -s "$ROOT/shell/Commons" "$config_dir/Commons" + +OMARCHY_PATH="$ROOT" \ +OMARCHY_QML_TEST_RESULT="$result" \ +OMARCHY_MENU_TMP="$scratch" \ +HOME="$TMPDIR/home" \ +XDG_CONFIG_HOME="$TMPDIR/home/.config" \ +XDG_CACHE_HOME="$TMPDIR/home/.cache" \ +XDG_STATE_HOME="$TMPDIR/home/.local/state" \ +QML2_IMPORT_PATH="$ROOT/shell${QML2_IMPORT_PATH:+:$QML2_IMPORT_PATH}" \ +QML_IMPORT_PATH="$ROOT/shell${QML_IMPORT_PATH:+:$QML_IMPORT_PATH}" \ +PATH="$ROOT/bin:$PATH" \ + quickshell -p "$config_dir" --no-color >"$log" 2>&1 & +QS_PID=$! + +for _ in {1..80}; do + [[ -s $result ]] && break + if ! kill -0 "$QS_PID" 2>/dev/null; then + sed -n '1,220p' "$log" >&2 + fail "menu select supersede quickshell exited before writing result" + fi + sleep 0.1 +done + +[[ -s $result ]] || { + sed -n '1,220p' "$log" >&2 + fail "menu select supersede test timed out" +} + +fixture_failed=0 +if ! jq -e '.ok == true' "$result" >/dev/null; then + printf 'Menu select supersede result:\n' >&2 + jq . "$result" >&2 + fixture_failed=1 +fi + +for name in a b; do + if [[ ! -e $scratch/done-$name ]]; then + printf 'done-%s was never written; the displaced omarchy-menu-select waiter would spin forever\n' "$name" >&2 + fixture_failed=1 + fi +done + +if (( fixture_failed )); then + printf 'Quickshell log:\n' >&2 + sed -n '1,220p' "$log" >&2 + fail "superseding a pending menu select strands its waiter" +fi + +pass "superseding a pending menu select finishes its request instead of leaking the waiter" From 833e51ef51174dfb4480e4b0813beab0be9aca05 Mon Sep 17 00:00:00 2001 From: wiko de la rosa Date: Sat, 22 Aug 2026 18:40:28 -0400 Subject: [PATCH 2/6] Queue menu-select completion writes so rapid supersedes cannot drop one --- shell/plugins/menu/Menu.qml | 17 ++++++++++++++--- .../fixtures/menu-select-supersede/shell.qml | 9 +++++++-- test/shell.d/menu-select-supersede-test.sh | 2 +- 3 files changed, 22 insertions(+), 6 deletions(-) diff --git a/shell/plugins/menu/Menu.qml b/shell/plugins/menu/Menu.qml index bf9b2eacb6b0..5516ec384c92 100644 --- a/shell/plugins/menu/Menu.qml +++ b/shell/plugins/menu/Menu.qml @@ -68,6 +68,16 @@ Item { property bool cursorActive: false property int requestSerial: 0 property int applySerial: 0 + // Completion writes share one Process, so they queue: a supersede can land + // while the previous write is still spawning, and reassigning a running + // Process would silently drop its command. + property var pendingDoneWrites: [] + + function runNextDoneWrite() { + if (resultProc.running || root.pendingDoneWrites.length === 0) return + resultProc.command = root.pendingDoneWrites.shift() + resultProc.running = true + } property var items: ({}) property var itemOrder: [] property var navStack: [] @@ -127,11 +137,11 @@ Item { root.doneFile = "" if (selection === null || selection === undefined) { - resultProc.command = ["bash", "-c", ": > " + Util.shellQuote(activeDoneFile)] + root.pendingDoneWrites.push(["bash", "-c", ": > " + Util.shellQuote(activeDoneFile)]) } else { - resultProc.command = ["bash", "-c", "printf '%s\\n' " + Util.shellQuote(selection) + " > " + Util.shellQuote(activeSelectionFile) + "; : > " + Util.shellQuote(activeDoneFile)] + root.pendingDoneWrites.push(["bash", "-c", "printf '%s\\n' " + Util.shellQuote(selection) + " > " + Util.shellQuote(activeSelectionFile) + "; : > " + Util.shellQuote(activeDoneFile)]) } - resultProc.running = true + root.runNextDoneWrite() } function runAction(action) { @@ -948,6 +958,7 @@ Item { Process { id: resultProc onExited: { + root.runNextDoneWrite() if (root.applySerial === root.requestSerial) root.opened = false } diff --git a/test/shell.d/fixtures/menu-select-supersede/shell.qml b/test/shell.d/fixtures/menu-select-supersede/shell.qml index ec6e394496b3..7f2d8e25bcfd 100644 --- a/test/shell.d/fixtures/menu-select-supersede/shell.qml +++ b/test/shell.d/fixtures/menu-select-supersede/shell.qml @@ -82,12 +82,17 @@ ShellRoot { root.assertTrue(root.menu.mode === "menu", "the regular menu takes over from select A") } - // Scenario B: a live select request is superseded by another select. + // Scenario B: several requests opened back-to-back with no delay in + // between, so b, c and d are displaced synchronously — possibly while + // an earlier completion write is still spawning. Their done files must + // all land anyway. if (tick === 12) { root.menu.open(root.selectPayload("B", "b")) root.assertTrue(root.menu.requestActive === true, "select B becomes the active request") root.menu.open(root.selectPayload("C", "c")) - root.assertTrue(root.menu.doneFile === root.scratchDir + "/done-c", "select C holds the live request afterwards") + root.menu.open(root.selectPayload("D", "d")) + root.menu.open(root.selectPayload("E", "e")) + root.assertTrue(root.menu.doneFile === root.scratchDir + "/done-e", "select E holds the live request afterwards") } if (tick === 20) root.finish() diff --git a/test/shell.d/menu-select-supersede-test.sh b/test/shell.d/menu-select-supersede-test.sh index c6a53a25f730..18738bd27a20 100755 --- a/test/shell.d/menu-select-supersede-test.sh +++ b/test/shell.d/menu-select-supersede-test.sh @@ -71,7 +71,7 @@ if ! jq -e '.ok == true' "$result" >/dev/null; then fixture_failed=1 fi -for name in a b; do +for name in a b c d; do if [[ ! -e $scratch/done-$name ]]; then printf 'done-%s was never written; the displaced omarchy-menu-select waiter would spin forever\n' "$name" >&2 fixture_failed=1 From 207e8d368631881d32811827aab15d9d6351f724 Mon Sep 17 00:00:00 2001 From: Omarchybot <317366263+omarchybot@users.noreply.github.com> Date: Mon, 16 Nov 2026 19:26:00 +0100 Subject: [PATCH 3/6] Run the menu supersede test through the shared QML fixture harness The hand-rolled runner reported a missing Quickshell as a pass rather than a skip, and its cleanup stopped only Quickshell, leaving any process the fixture started behind. require_quickshell and run_qml_fixture in base-test.sh do both properly and replace the copied setup. Co-Authored-By: Claude Opus 5.5 Co-Authored-By: Codex Medium Co-Authored-By: muse-wonder via pi, thinking high --- test/shell.d/menu-select-supersede-test.sh | 79 ++-------------------- 1 file changed, 7 insertions(+), 72 deletions(-) diff --git a/test/shell.d/menu-select-supersede-test.sh b/test/shell.d/menu-select-supersede-test.sh index 18738bd27a20..9e5244a4a287 100755 --- a/test/shell.d/menu-select-supersede-test.sh +++ b/test/shell.d/menu-select-supersede-test.sh @@ -4,84 +4,19 @@ set -euo pipefail source "$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)/base-test.sh" -TMPDIR="" -QS_PID="" +require_quickshell "menu select supersede test" -cleanup() { - if [[ -n $QS_PID ]] && kill -0 "$QS_PID" 2>/dev/null; then - kill "$QS_PID" 2>/dev/null || true - wait "$QS_PID" 2>/dev/null || true - fi - if [[ -n $TMPDIR && -d $TMPDIR ]]; then - rm -rf "$TMPDIR" - fi -} -trap cleanup EXIT - -require_compositor "menu select supersede test" - -if ! command -v quickshell >/dev/null 2>&1; then - pass "quickshell not installed; skipping menu select supersede test" - exit 0 -fi - -require_command jq - -TMPDIR=$(mktemp -d) -result="$TMPDIR/result.json" -log="$TMPDIR/quickshell.log" -scratch="$TMPDIR/scratch" -config_dir="$TMPDIR/menu-select-supersede" -mkdir -p "$config_dir" "$scratch" -cp "$SHELL_TEST_DIR/fixtures/menu-select-supersede/shell.qml" "$config_dir/shell.qml" -ln -s "$ROOT/shell/Ui" "$config_dir/Ui" -ln -s "$ROOT/shell/Commons" "$config_dir/Commons" +qml_fixture_scratch +scratch="$QML_FIXTURE_TMP/scratch" +mkdir -p "$scratch" -OMARCHY_PATH="$ROOT" \ -OMARCHY_QML_TEST_RESULT="$result" \ -OMARCHY_MENU_TMP="$scratch" \ -HOME="$TMPDIR/home" \ -XDG_CONFIG_HOME="$TMPDIR/home/.config" \ -XDG_CACHE_HOME="$TMPDIR/home/.cache" \ -XDG_STATE_HOME="$TMPDIR/home/.local/state" \ -QML2_IMPORT_PATH="$ROOT/shell${QML2_IMPORT_PATH:+:$QML2_IMPORT_PATH}" \ -QML_IMPORT_PATH="$ROOT/shell${QML_IMPORT_PATH:+:$QML_IMPORT_PATH}" \ -PATH="$ROOT/bin:$PATH" \ - quickshell -p "$config_dir" --no-color >"$log" 2>&1 & -QS_PID=$! - -for _ in {1..80}; do - [[ -s $result ]] && break - if ! kill -0 "$QS_PID" 2>/dev/null; then - sed -n '1,220p' "$log" >&2 - fail "menu select supersede quickshell exited before writing result" - fi - sleep 0.1 -done - -[[ -s $result ]] || { - sed -n '1,220p' "$log" >&2 - fail "menu select supersede test timed out" -} - -fixture_failed=0 -if ! jq -e '.ok == true' "$result" >/dev/null; then - printf 'Menu select supersede result:\n' >&2 - jq . "$result" >&2 - fixture_failed=1 -fi +OMARCHY_MENU_TMP="$scratch" run_qml_fixture menu-select-supersede "the menu takes over from pending select requests" Ui Commons for name in a b c d; do if [[ ! -e $scratch/done-$name ]]; then - printf 'done-%s was never written; the displaced omarchy-menu-select waiter would spin forever\n' "$name" >&2 - fixture_failed=1 + sed -n '1,220p' "$QML_FIXTURE_LOG" >&2 + fail "superseding a pending menu select strands its waiter" "done-$name was never written; the displaced omarchy-menu-select waiter would spin forever" fi done -if (( fixture_failed )); then - printf 'Quickshell log:\n' >&2 - sed -n '1,220p' "$log" >&2 - fail "superseding a pending menu select strands its waiter" -fi - pass "superseding a pending menu select finishes its request instead of leaking the waiter" From 5f66a7c906dff947f58fab831872c3fb961532e1 Mon Sep 17 00:00:00 2001 From: Omarchybot <317366263+omarchybot@users.noreply.github.com> Date: Mon, 16 Nov 2026 19:36:11 +0100 Subject: [PATCH 4/6] Move the menu supersede check into menu-test.sh The house rules ask for an area's existing test file to be extended rather than a new one added, so the check now runs at the end of menu-test.sh, after its headless checks, and skips there without a compositor. Co-Authored-By: Claude Opus 5.5 --- test/shell.d/menu-select-supersede-test.sh | 22 ---------------------- test/shell.d/menu-test.sh | 19 +++++++++++++++++++ 2 files changed, 19 insertions(+), 22 deletions(-) delete mode 100755 test/shell.d/menu-select-supersede-test.sh diff --git a/test/shell.d/menu-select-supersede-test.sh b/test/shell.d/menu-select-supersede-test.sh deleted file mode 100755 index 9e5244a4a287..000000000000 --- a/test/shell.d/menu-select-supersede-test.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/bash - -set -euo pipefail - -source "$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)/base-test.sh" - -require_quickshell "menu select supersede test" - -qml_fixture_scratch -scratch="$QML_FIXTURE_TMP/scratch" -mkdir -p "$scratch" - -OMARCHY_MENU_TMP="$scratch" run_qml_fixture menu-select-supersede "the menu takes over from pending select requests" Ui Commons - -for name in a b c d; do - if [[ ! -e $scratch/done-$name ]]; then - sed -n '1,220p' "$QML_FIXTURE_LOG" >&2 - fail "superseding a pending menu select strands its waiter" "done-$name was never written; the displaced omarchy-menu-select waiter would spin forever" - fi -done - -pass "superseding a pending menu select finishes its request instead of leaking the waiter" diff --git a/test/shell.d/menu-test.sh b/test/shell.d/menu-test.sh index dcd8c08e8ffb..2c0bc418a24c 100644 --- a/test/shell.d/menu-test.sh +++ b/test/shell.d/menu-test.sh @@ -439,3 +439,22 @@ const missingGlyphs = fontGlyphRows .map(({ id, code }) => `${id} U+${code.toString(16)}`) assertDeepEqual(missingGlyphs, [], 'every menu glyph drawn in the Omarchy font is one the font carries') JS + +# A select displaced by the menu or by a newer select still gets its done file, +# or the omarchy-menu-select waiting on it polls forever. +require_quickshell "menu select supersede test" + +qml_fixture_scratch +scratch="$QML_FIXTURE_TMP/scratch" +mkdir -p "$scratch" + +OMARCHY_MENU_TMP="$scratch" run_qml_fixture menu-select-supersede "the menu takes over from pending select requests" Ui Commons + +for name in a b c d; do + if [[ ! -e $scratch/done-$name ]]; then + sed -n '1,220p' "$QML_FIXTURE_LOG" >&2 + fail "superseding a pending menu select strands its waiter" "done-$name was never written; the displaced omarchy-menu-select waiter would spin forever" + fi +done + +pass "superseding a pending menu select finishes its request instead of leaking the waiter" From cb4cae63a890f3425d6859d5c63981269c5343e4 Mon Sep 17 00:00:00 2001 From: Omarchybot <317366263+omarchybot@users.noreply.github.com> Date: Thu, 26 Nov 2026 17:15:02 +0100 Subject: [PATCH 5/6] Finish pending requests before opening keybindings Carry the active-request guard from #9056 across all three entry points. The native keybindings menu now clears request state too, and must answer the displaced caller first. Guarding the finish also avoids closing and reopening an idle menu. Extend the runtime fixture to cover a select displaced by keybindings and check that delayed writes leave the replacement open. Co-Authored-By: FernandoJVideira <03.pleaser-minster@icloud.com> Co-Authored-By: GPT-6 (Codex) --- shell/plugins/menu/Menu.qml | 5 +++-- .../fixtures/menu-select-supersede/shell.qml | 20 +++++++++++++------ test/shell.d/menu-test.sh | 3 ++- 3 files changed, 19 insertions(+), 9 deletions(-) diff --git a/shell/plugins/menu/Menu.qml b/shell/plugins/menu/Menu.qml index a11854a086f3..bc366de497bb 100644 --- a/shell/plugins/menu/Menu.qml +++ b/shell/plugins/menu/Menu.qml @@ -1031,7 +1031,7 @@ Item { function openExistingMenu(initialMenu) { // Taking the surface over must not drop a live select/input request: // its waiter polls the done file forever once these handles are cleared. - root.finishRequest(null) + if (root.requestActive) root.finishRequest(null) altHeld = false requestSerial += 1 mode = "menu" @@ -1059,7 +1059,7 @@ Item { function openDmenu(payload) { // Same contract as openExistingMenu: a request displaced by a newer one // still gets its done file written, or the waiting script never exits. - root.finishRequest(null) + if (root.requestActive) root.finishRequest(null) requestSerial += 1 mode = payload.mode === "input" ? "input" : "select" dmenuPrompt = String(payload.prompt || (mode === "input" ? Commons.I18n.t("menu.inputPrompt") : Commons.I18n.t("menu.selectPrompt"))) @@ -1106,6 +1106,7 @@ Item { } function openKeybindings() { + if (root.requestActive) root.finishRequest(null) altHeld = false requestSerial += 1 mode = "keybindings" diff --git a/test/shell.d/fixtures/menu-select-supersede/shell.qml b/test/shell.d/fixtures/menu-select-supersede/shell.qml index 7f2d8e25bcfd..0dedf3d55c67 100644 --- a/test/shell.d/fixtures/menu-select-supersede/shell.qml +++ b/test/shell.d/fixtures/menu-select-supersede/shell.qml @@ -1,11 +1,8 @@ import QtQuick import Quickshell -// Drives the REAL shell/plugins/menu/Menu.qml through the two supersede paths -// that strand a waiting omarchy-menu-select: opening the regular menu over an -// active select request, and opening a new select request over another one. -// The bash runner asserts afterwards that every displaced request had its done -// file written, which is what lets the waiting script exit. +// Displacing a real Menu.qml request must write its completion file so the +// waiting command exits, including when keybindings take over the surface. ShellRoot { id: root @@ -95,7 +92,18 @@ ShellRoot { root.assertTrue(root.menu.doneFile === root.scratchDir + "/done-e", "select E holds the live request afterwards") } - if (tick === 20) root.finish() + // Scenario C: the native keybindings menu replaces a live select. + if (tick === 20) { + root.menu.open(root.selectPayload("F", "f")) + root.menu.open(JSON.stringify({ mode: "keybindings" })) + root.assertTrue(root.menu.mode === "keybindings", "keybindings take over from select F") + root.assertTrue(!root.menu.requestActive, "keybindings clear the old request") + } + + if (tick === 28) { + root.assertTrue(root.menu.opened, "completion writes leave the replacement menu open") + root.finish() + } } catch (error) { root.fail("menu supersede fixture threw: " + error) root.finish() diff --git a/test/shell.d/menu-test.sh b/test/shell.d/menu-test.sh index 3aa96533659b..d1b58f8c628a 100644 --- a/test/shell.d/menu-test.sh +++ b/test/shell.d/menu-test.sh @@ -550,11 +550,12 @@ mkdir -p "$scratch" OMARCHY_MENU_TMP="$scratch" run_qml_fixture menu-select-supersede "the menu takes over from pending select requests" Ui Commons -for name in a b c d; do +for name in a b c d e f; do if [[ ! -e $scratch/done-$name ]]; then sed -n '1,220p' "$QML_FIXTURE_LOG" >&2 fail "superseding a pending menu select strands its waiter" "done-$name was never written; the displaced omarchy-menu-select waiter would spin forever" fi + [[ ! -s $scratch/sel-$name && ! -s $scratch/done-$name ]] || fail "a displaced menu request is cancelled" "request $name returned a selection" done pass "superseding a pending menu select finishes its request instead of leaking the waiter" From 812d79b6ca6d89e19652f1e82073dec1fdea5fe6 Mon Sep 17 00:00:00 2001 From: Omarchybot <317366263+omarchybot@users.noreply.github.com> Date: Thu, 26 Nov 2026 17:24:23 +0100 Subject: [PATCH 6/6] Check selected values queued behind superseded requests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Exercise a selected value while cancellations still occupy the completion writer, as the panel review suggested. Preserve the payload tests’ existing scratch cleanup when the QML fixture installs its cleanup handler. Co-Authored-By: muse-wonder via pi, thinking high Co-Authored-By: GPT-6 (Codex) --- test/shell.d/fixtures/menu-select-supersede/shell.qml | 1 + test/shell.d/menu-test.sh | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/test/shell.d/fixtures/menu-select-supersede/shell.qml b/test/shell.d/fixtures/menu-select-supersede/shell.qml index 0dedf3d55c67..3d8944e2da33 100644 --- a/test/shell.d/fixtures/menu-select-supersede/shell.qml +++ b/test/shell.d/fixtures/menu-select-supersede/shell.qml @@ -90,6 +90,7 @@ ShellRoot { root.menu.open(root.selectPayload("D", "d")) root.menu.open(root.selectPayload("E", "e")) root.assertTrue(root.menu.doneFile === root.scratchDir + "/done-e", "select E holds the live request afterwards") + root.menu.applyDmenuSelection("bravo") } // Scenario C: the native keybindings menu replaces a live select. diff --git a/test/shell.d/menu-test.sh b/test/shell.d/menu-test.sh index d1b58f8c628a..bcff9f5da2ae 100644 --- a/test/shell.d/menu-test.sh +++ b/test/shell.d/menu-test.sh @@ -545,12 +545,13 @@ pass "the Snapshots provider lists systemd-boot's entries and asks nothing of Li require_quickshell "menu select supersede test" qml_fixture_scratch +trap 'qml_fixture_cleanup; rm -rf "$select_tmp"' EXIT scratch="$QML_FIXTURE_TMP/scratch" mkdir -p "$scratch" OMARCHY_MENU_TMP="$scratch" run_qml_fixture menu-select-supersede "the menu takes over from pending select requests" Ui Commons -for name in a b c d e f; do +for name in a b c d f; do if [[ ! -e $scratch/done-$name ]]; then sed -n '1,220p' "$QML_FIXTURE_LOG" >&2 fail "superseding a pending menu select strands its waiter" "done-$name was never written; the displaced omarchy-menu-select waiter would spin forever" @@ -558,4 +559,6 @@ for name in a b c d e f; do [[ ! -s $scratch/sel-$name && ! -s $scratch/done-$name ]] || fail "a displaced menu request is cancelled" "request $name returned a selection" done +[[ -e $scratch/done-e && $(cat "$scratch/sel-e") == "bravo" ]] || fail "a selected value queues behind cancellation writes" "select E did not return bravo" + pass "superseding a pending menu select finishes its request instead of leaking the waiter"