Skip to content

Keep the launch OSD timeout from being restarted indefinitely - #13095

Open
surim0n wants to merge 2 commits into
omacom:quattrofrom
surim0n:fix/osd-toast-stuck
Open

surim0n wants to merge 2 commits into
omacom:quattrofrom
surim0n:fix/osd-toast-stuck

Conversation

@surim0n

@surim0n surim0n commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Refs #12922.

The "Launching …" OSD could stay on screen past its safety net, and once its close was missed there was nothing left to hide it.

  • launchDelay.onTriggered now shows the OSD with a finite duration equal to the 15s deadline instead of duration: 0, so the toast self-hides even if the detached osd close is processed before the osd show (the two are independent omarchy-shell IPC calls with no ordering between them)
  • launchTimeout is no longer restarted for a retriggered launch of the same app, so repeated clicks cannot push the deadline out indefinitely; launching a different app starts a fresh 15s window so its own feedback is not cut short by the previous app's deadline
  • launchDelay still restarts so a retriggered launch updates the toast text

The reporter's repro goes through omarchy-launch-nautilus, which does not use this code path, so this is filed as Refs rather than Fixes until the menu-launch case is confirmed.

Test plan

  • test/shell.d/app-library-launch-test.sh asserts the finite OSD duration, the same-app guard on the timeout, and that the timeout is not restarted unconditionally
  • Launch an app from the shell menu, retrigger it a few times, confirm the toast closes when the window appears and never outlives 15s

Fixes #10487

`beginLaunchFeedback` restarted `launchTimeout` on every invocation, so
retriggering a launch pushed the 15s safety-net back each time and the toast
could stay on screen indefinitely.

- Start `launchTimeout` only when it is not already running; the first
  launch's deadline still bounds the feedback
- `launchDelay` still restarts so a retriggered launch updates the toast text

Fixes omacom#12922.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@llstrk

llstrk commented Sep 25, 2026

Copy link
Copy Markdown

Automated AI review

Community review: Independent automated community review, unaffiliated with the Omarchy team, intended to help prepare PRs for their review.

Verified: the timer change behaves as described. On a running QML Timer, start() is a no-op (QQmlTimer::start() calls setRunning(true), which returns early when already running), so repeated beginLaunchFeedback calls no longer push the 15 s safety net back. Single launches, closing when a window appears or focus changes, the no-window path (toast from 2 s to 15 s) and a relaunch after earlier feedback has resolved are unchanged. The earlier stranding fix from 43c15a4 is not reverted.

Two points may affect whether this closes #12922, plus a test note.

The reported stuck toast is not explained by restart()

Before this PR, launchTimeout.restart() moved the deadline to 15 s after the latest launch, and launchTimeout.onTriggered closes feedback for whichever launch is current. The toast could therefore outlast 15 s only while launches kept being retriggered.

Toast lifetime after the last retrigger
Base closes when a window appears, otherwise at most 15 s after the last launch
This PR closes when a window appears, otherwise at the first pending launch's 15 s deadline

The issue describes a different symptom: the toast stayed after the window had opened, until omarchy-shell osd close was run by hand. That requires a close that never took effect. Two further source observations:

  • The issue's reproduction steps do not reach this code at the reviewed head. The Files binding (SUPER + SHIFT + F) and omarchy launch nautilus both run bin/omarchy-launch-nautilus, which starts Nautilus directly. Only the shell menu's app list (shell/plugins/menu/Menu.qml) and plugins using the app-library API call beginLaunchFeedback.
  • AppLibrary.qml, Osd.qml, OsdModel.js and bin/omarchy-shell at the v4.0.4 tag (the reporter's version) are byte-identical to this PR's base.

Possible cause (source reading only, not reproduced): the launch OSD show (with duration: 0) and its close are sent as two independent Quickshell.execDetached processes, each running its own omarchy-shell IPC call, with nothing ordering them.

launchDelay fires      -> launchOsdOpen = true;  spawn "osd show" (duration 0)
window opens soon after -> closeLaunchFeedback:   spawn "osd close"; launchOsdOpen = false
IPC handles close first -> nothing shown yet, close has no effect
IPC handles show second -> OSD opened, no hide timer
AppLibrary               -> launchOsdOpen already false, so no further close is sent

Impact: the Fixes #12922 keyword would close the issue automatically while the reported symptom may still occur.

Suggested change: confirm the stuck toast reproduces through the app menu before the change and not after. If the ordering race is the cause, giving the launch OSD a finite duration (for example the same 15 s) would bound it even when a close is lost. Sending show and close through one ordered path would also address it. Without such a reproduction, Refs #12922 may fit better than Fixes.

A different app launched near the first deadline loses its feedback

The timeout is no longer restarted for a new launch, but it still closes whichever launch is current. If app A has not opened a window and app B is launched from the menu shortly before A's deadline, B's feedback is cut off:

Head, derived from source reading (not reproduced); neither app has opened a window yet
t=0    launch A  -> launchDelay 2 s, launchTimeout armed for t=15
t=2    "Launching A…" shown
t=14   launch B  -> launchDelay restarted (would fire t=16); timeout kept at t=15
t=15   timeout   -> closeLaunchFeedback(current serial = B): delay stopped, OSD closed
                    B never shows "Launching B…"

Base: the timeout restarts at t=14, so "Launching B…" shows at t=16 and lasts until
B's window appears or t=29.

If B is launched earlier than 13 s, its toast appears but closes at A's deadline even if B is still starting.

Impact: feedback only; B still launches. A plausible trigger is a slow or silently failed first launch followed by trying a different app.

Suggested change: keep the running deadline only when the retriggered launch is the same desktop ID, and start a fresh 15 s window for a different app. The PR description presents the first-deadline behaviour as intended, so documenting this trade-off is an alternative.

Optional test improvement: test/shell.d/app-library-launch-test.sh checks source text only. Its first check, a file-wide grep 'launchTimeout\.running', already passes on the unfixed base because it matches maybeFinishLaunchFeedback. A variant that re-adds launchTimeout.restart() after the guard passes every assertion. Asserting that launchTimeout.restart() is absent from the beginLaunchFeedback body, and scoping or dropping the file-wide grep, would make the test guard the actual bug.


Review information

Test scope: Source review of head 2a98d2c and base 28ceaae, the upstream v4.0.4 tag, qtdeclarative QQmlTimer source (v6.8.3 and v6.11.2) and Quickshell 0.3.1 execDetached. The PR test's bash checks ran in an isolated sandbox against the head, the base and two modified variants. Its Node block could not run there (Node unavailable) and was evaluated with an equivalent regex transliteration. No desktop session was used. The show/close ordering race and the timelines above come from source reading and were not reproduced at runtime.

AI process: Opus 5.5 Medium coordination and synthesis, independent Opus 5.5 Xhigh and GPT 6 Sol Xhigh technical assessments, Opus 5.5 Medium editorial check.

Opt out: To stop receiving these reviews, reply to this comment saying so.

@surim0n

surim0n commented Sep 25, 2026

Copy link
Copy Markdown
Contributor Author

Fair point that restart() alone does not explain a toast outliving its window. 3d821e3 does two things: the launch OSD is shown with a finite duration equal to the 15 s deadline so a lost close can no longer leave it up, and the timeout is only kept running for a retriggered launch of the same app; a different app gets a fresh window so its feedback is not cut short. Description switched to Refs #12922 since the reporter's repro goes through omarchy-launch-nautilus, which does not use this path. Test now guards the actual body.

@llstrk

llstrk commented Sep 27, 2026

Copy link
Copy Markdown

Automated AI review

Community review: Independent automated community review, unaffiliated with the Omarchy team, intended to help prepare PRs for their review.

Follow-up on the earlier review after the author's reply, checked at head 3d821e3.

Outcome: both earlier findings are resolved at this head, and the test now guards the regression it was meant to catch. One statement in the earlier review was wrong and is corrected below. Four smaller notes follow.

Earlier item Status at 3d821e3
Stuck toast not explained by restart() Resolved: the launch OSD now has a finite duration, and the description says Refs #12922. One supporting claim is withdrawn (see the correction)
Different app launched near the first deadline loses its feedback Resolved
Optional test improvement Resolved

Verified: in a QML model built from each revision's own AppLibrary.qml and Osd.qml code (stubbed toplevels and IPC delivery, see Test scope):

Scenario Base Previous head This head
close delivered before show still up at the end of the 40 s run still up at the end of the 40 s run hides 15 s after it appears (about 17 s after the launch)
Same app launched at 0, 5, 10 s, no window closes at 25 s closes at 15 s closes at 15 s
App A at 0 s, different app B at 14 s B shown 16 s to 29 s B never shown, closed at 15 s B shown 16 s to 29 s

The 15 s self-hide counts from when the toast appears, not from the launch deadline. In the reordered case after a same-app retrigger it can therefore last until about 15 s after the retrigger's toast. In normal delivery the timeout or a new window always closes the toast first. The stranding fix from 43c15a4 is still intact, and the existing app-search and OSD tests pass at this head.

Correction: the issue's reproduction does reach this code

The earlier review stated that the reproduction steps in #12922 do not reach beginLaunchFeedback, because the Files binding and omarchy launch nautilus run bin/omarchy-launch-nautilus. That was wrong:

  • Step 1 of the issue also lists "the Files entry in the app menu". That entry runs Menu.qml activateIndex -> appLibrary.launch -> beginLaunchFeedback.
  • The toast text the reporter quotes, "Launching Files…", is produced only by beginLaunchFeedback (at v4.0.4 and at this head). omarchy-launch-nautilus shows no OSD.

So the reported toast came from this code path. The rest of that finding stands: at base, a toast that stays up longer than 15 s after the last launch still needs a close that never took effect, and the show/close ordering race remains a source-level explanation that has not been reproduced in a live shell.

Impact: the PR description repeats the incorrect reason ("The reporter's repro goes through omarchy-launch-nautilus, which does not use this code path").

Suggested change: update that sentence. Refs versus Fixes remains a call for the maintainers: the likely cause is now bounded rather than removed, and it is still unreproduced.

"Same app" is keyed on the display name

beginLaunchFeedback receives only name, and sameApp compares display names. Two different desktop entries with the same Name (for example a native and a Flatpak build), or two plugin launches without a name (PluginAppLibraryApi.launch passes ""), count as the same app:

Model run, this head: two different entries both named "Files", no window yet
t=0    launch entry 1 -> timeout armed for t=15
t=14   launch entry 2 -> same name, timeout kept at t=15
t=15   timeout        -> feedback closed while entry 2 is still starting;
                         entry 2 never gets its own toast

Impact: feedback only, and only for name collisions within the 15 s window. It is the earlier different-app case in a narrower form.

Suggested change: launch(desktopId, name) already has the desktop ID. Passing it to beginLaunchFeedback and comparing IDs, while keeping the name for the toast text, matches the intent in the reply.

Stale comment: the comment on launchOsdOpen (AppLibrary.qml lines 29-31) still says the OSD "shows with duration 0, so only closeLaunchFeedback() takes it down".

Optional test improvement: two one-line regressions still pass every assertion in app-library-launch-test.sh. Deleting root.launchName = String(name || "") makes every named retrigger look like a different app, so the deadline moves again (launches at 0, 5 and 10 s close at 25 s, as on base). Moving that assignment above the sameApp comparison makes every launch look like the same app, which brings back the different-app case. Asserting that the assignment exists after the comparison would catch both. The message "self-hides at the launch deadline" also overstates the timing, since the 15 s starts when the toast appears.

Related open PRs: #12966 makes this PR's earlier timer change (if (!launchTimeout.running) launchTimeout.start(), as at 2a98d2c, without the per-app restart), and its added app-search-test.sh assertions forbid any launchTimeout.restart() in beginLaunchFeedback, which this PR now uses on purpose for a different app. #11568 adds the same OSD duration backstop, and its test expects the literal duration: 15000 rather than launchTimeout.interval (same value). Both edit the same AppLibrary.qml lines, so whichever change lands, the others would need reconciling.


Review information

Test scope: Source review of head 3d821e3, previous head 2a98d2c and base 28ceaae, the upstream v4.0.4 tag, qtdeclarative QQmlTimer source and Quickshell 0.3.1 execDetached and IPC handling. The PR's test ran in an isolated sandbox with Node against the head, the base, the previous head and labelled one-line variants. The timelines come from a QML model run with qml6 6.11.2 in core mode: verbatim launch-feedback and OSD code from each revision, with stubbed toplevels, stubbed IPC delivery (in order, or with close moved before show) and time scaled 1/5. No live shell or desktop session was used, and the show/close ordering race was not reproduced in a real shell. The related open PRs were compared by their file changes only.

AI process: Opus 5.5 Medium coordination and synthesis, Opus 5.5 Xhigh technical review and final fact check, GPT 6 Sol Xhigh search for related issues, Opus 5.5 Medium editorial check.

Opt out: To stop receiving these reviews, reply to this comment saying so.

@omarchybot

Copy link
Copy Markdown
Collaborator

Reviewed at 3d821e3 against quattro, by reading the source. AppLibrary.qml has not changed on quattro since this branched. Nothing ran on a worker: three open pull requests fix #12922, and verifying one of them only helps once it is clear which one should land.

The stuck toast needs a lost or reordered close. The launch OSD is shown with duration: 0, and Osd.qml starts no hide timer for that. The osd show and osd close are two separate detached omarchy-shell calls, so if the window opens just after the toast is shown and the close arrives first, the show leaves the toast up with nothing left to close it. launchTimeout.restart() alone cannot do that. Once launches stop, the timeout fires 15s after the last one and closes the current serial. So the part of this PR that fixes #12922 is the finite duration.

That same change is all of #11568, which is older and already carries verified and ready. The second change here, keeping the deadline for a launch with the same name, is not needed for this bug, and it costs something. sameApp compares display names, so two different entries both named "Files", or two plugin launches with an empty name, share a deadline. A second one launched at 14s has its 2s delay stopped by the first one's timeout at 15s, so it never gets a toast. #12966 changes only the timeout and leaves duration: 0, so it does not remove the cause.

Also at this head: the comment on launchOsdOpen (AppLibrary.qml lines 29-31) still says the OSD shows with duration 0 and only closeLaunchFeedback() takes it down, which is no longer true. The new test matches source text and never runs launch feedback, so it shows the change is present but not that the toast closes.

Second opinion: Codex Medium was asked which of #13095, #11568 and #12966 is best without being given this conclusion. It picked #11568 for the same reason and independently traced the same-name collision. Its independence is not guaranteed.

This is waiting on the maintainer to choose between #11568, #13095 and #12966. Whichever lands, the others touch the same lines of AppLibrary.qml and will need closing or reconciling.

@chessing234

Copy link
Copy Markdown
Contributor

both of your commits are in #21025. the same app keeps its deadline, and a different app gets a fresh 15s. the show goes through the tracked call, with duration equal to that deadline, not a second detached show. @dhh @omarchybot if 21025 lands, this can close as superseded.

@omarchybot

Copy link
Copy Markdown
Collaborator

Codex High and Opus 5.5 High compared the fixes with current quattro in source. #21025 closed without merging. #9819 shipped in v4.6.0-rc1 and fixed the stuck toast by moving show and hide into the shell process and giving the toast a finite lifetime. This branch now conflicts with that change.

For repeat launches, both reviews preferred the older #12966 and its Quickshell timing test. Review independence is unverified. I queued this PR’s remaining improvement for #12966. A different app should get a fresh deadline, since reusing the old one can suppress the second toast if less than two seconds remain. Comparing desktop IDs would also give two apps with the same display name separate deadlines. No worker tests ran. This PR stays open for the maintainer’s decision.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] “Launching X...” notification never disappears

4 participants