Skip to content

omamobile-shell: recent apps stop a card's live copy before closing its window (the shell restarted) - #985

Merged
derekross merged 3 commits into
derekross:mainfrom
W4HO-ham:shell-switcher-close-capture
Nov 24, 2026
Merged

derekross merged 3 commits into
derekross:mainfrom
W4HO-ham:shell-switcher-close-capture

Conversation

@W4HO-ham

Copy link
Copy Markdown
Contributor

Closing an app from recent apps could restart the whole shell: the bar, the home screen and every plugin went away and came back a few seconds later. The owner of my palmtop had seen it several times; this morning the journal had it.

What happened. A card in recent apps shows a live copy of its window (ScreencopyView, live: true). A flick up asked the window to close while that copy was still running. On the palmtop (Pixel 9a, Hyprland 0.57.0-3.3, quickshell 0.3.2.r7, Omarchy 4.5.0-3), in one second:

Hyprland:      Started screenshare session for (window): …
Hyprland:      [Window …] unmapped
Hyprland:      Stopped screenshare session for (window): …
omarchy-shell: WARN: The Wayland connection experienced a fatal error: Invalid argument
omarchy-shell: Omarchy shell exited with status 255; relaunching.

The shell's own log ends with the closewindow event and ToplevelHandle … closed. I have not found which request the compositor refuses once the window is gone, only that it comes from a copy that is still running: with the copy stopped first it doesn't happen.

The change, in omamobile.switcher/Switcher.qml only:

  • A flicked card drops its copy's source first, flies off (the 160 ms it already took), and the window is asked to close after that. A window that stays, such as an app asking about unsaved work, gets its copy back after 1.5 s.
  • Clear all had the same order: every window was asked to close and the cards stopped copying only when recent apps closed after it. It now stops every card's copy, and asks the windows 120 ms later. The second request through Hyprland for a window still open after 2 s is as before.

On the palmtop. With the same change made by hand in the installed Switcher.qml and the shell reloaded, the owner flicked apps closed, 16 windows in all by the journal, and the shell stayed up: no fatal error and no relaunching line since. He did not use Clear all (the journal has no "clear all, closing" line), so that half has run in the tests only.

Tests. test/switcher-touch.qml gains three cases, with the stub window noting how many cards still copied it when it was asked to close: a flicked card has stopped copying by then, a window that stays after a flick gets its copy back, and Clear all stops both copies before either close. Taking card.closing out of the binding fails the first two; leaving closingAll false fails the third. Three older Clear all cases wait for the close now that it comes 120 ms after the tap.

tests/all and tools/pr-check origin/main pass. The package's own test/all passed on a quiet machine; in two earlier runs with the laptop loaded (load average about 9) it failed once on "overlapping power-key presses" with "delay 1 produced wrong screen state or brightness", and once on "the keeper is a plain cat on the pty", different tests each time and none of them the switcher's. I haven't checked whether main does the same under that load.

Not run: a Pixel 7 Pro, Clear all on a phone, and the built package (the palmtop has the one file changed by hand). version is untouched; set it when it merges, as with the other shell pull requests.

…ts window

Flicking a card up, or Clear all, asked the window to close while the card's ScreencopyView was still copying it. The compositor ended the copy with the window, the shell's Wayland connection failed with "fatal error: Invalid argument", and the whole shell restarted, home screen and all. The copy now stops first: a flicked card drops its source before it flies off and the window is asked after that, Clear all drops every card's source and asks 120 ms later, and a window that stays gets its copy back.

@derekross derekross left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Thank you for this, and for finding it in the journal rather than guessing: a shell restart on a flick in recent apps is exactly the kind of thing an owner can't report usefully.

I read the change and ran test/switcher-touch on your branch merged with today's main: 18 pass. Taking card.closing out of the copy's binding fails your two flick cases, and leaving closingAll false fails the Clear all case, so all three bite. The checks are green on today's main and it merges cleanly with the other shell pull requests open now.

What your tests can't show is whether Quickshell's real ScreencopyView stops its capture as soon as its source becomes null; your 16 flicks without a restart say it does on the 9a. Since recent apps is the same on every phone, I'll run it on my Pixel 7 Pro before it merges: flicks, Clear all (which hasn't run on a phone yet), and a look at what a card shows while it flies off with its copy stopped. I'll set the version when it merges. Nothing more is needed from you unless that run finds something.

@derekross derekross left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

I ran this on my Pixel 7 Pro today, built from your head merged with today's main, together with #985, #986 and #994 in one shell build (they touch different files).

Recent apps: flicking a card up closes its window and the card flies off cleanly, five times with fresh windows (foot twice, Chromium); Clear all with three windows closes them all and dismisses recent apps. No fatal error, no shell relaunch in the journal for the whole session, one Quickshell throughout. It passes on the 7 Pro. It needs the next free shell number at merge; I'll push that to your branch (main merged in) and squash it once CI is green.

@derekross
derekross merged commit 9003f70 into derekross:main Nov 24, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants