fix: open the picked app from the mobile app switcher

The switcher only focused the window it was given. `FOCUS_WINDOW` raises
and focuses but never un-minimizes, while the mobile shell renders a
window only when it is focused *and* not minimized — so picking a
minimized app updated the URL and the document title (both follow
`focusedId`) while the home screen stayed on screen.

Restore a minimized window instead of merely focusing it, the same way the
menu bar's Window menu and the command palette already do.

Fixes #15

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Trku191Ww2a2YmDWQF3fTS
This commit is contained in:
mroxso
2026-09-06 12:03:34 +02:00
parent 949a551492
commit 6b64d2ddd7

View File

@@ -21,8 +21,16 @@ import { cn } from '@/lib/utils';
* app at a time.
*/
export function MobileAppShell() {
const { windows, focusedId, openApp, focusWindow, closeWindow, setWindowTitle, setWindowParams } =
useWindowManager();
const {
windows,
focusedId,
openApp,
focusWindow,
restoreWindow,
closeWindow,
setWindowTitle,
setWindowParams,
} = useWindowManager();
const [switcherOpen, setSwitcherOpen] = useState(false);
const active = useMemo(
@@ -74,7 +82,11 @@ export function MobileAppShell() {
key={win.id}
type="button"
onClick={() => {
focusWindow(win.id);
// Focusing alone leaves a minimized window minimized,
// and the shell only renders a window that is focused
// *and* not minimized — the home screen would stay up.
if (win.minimized) restoreWindow(win.id);
else focusWindow(win.id);
setSwitcherOpen(false);
}}
className={cn(