[BUG] Desktop: plugin `$.ui.toast` shows in the main window, not the window holding the session
What's Wrong?
In the desktop app's Code tab, a plugin's $.ui.toast(text) always appears in the app's main window, not in the window showing the session that raised it.
Setup: main window on the laptop's built-in display, the session open in a second app window on an external display. The toast shows at the top right of the main window, so someone working in the second window never sees it. Reproduced three times in a row.
Same result from a plugin slash command (command.run) and from a hook handling a click on the plugin's card (ui.message from a Client module).
By contrast, the app's own notices (e.g. the yellow card when a message can't be rewound) appear in whichever window you're working in.
What Should Happen?
The toast appears in the window(s) showing the session that raised it, as the API docs describe (plugin toasts over the transcript's top right corner), or at least in the focused window holding that session.
Steps to Reproduce
- In a plugin, register a command via
$.command.registerinsession.start, and handle it:on('command.run', { command: 'toasttest' }, ($) => { $.ui.toast('hello'); return { text: 'sent' } }) - Open a session in a second app window, on a second display.
- Run
/toasttestin that window. - The toast appears in the main window, not the second one.
Workaround
Show the confirmation inside the plugin's own card instead.
Environment
- Claude desktop app 5.11492.5 (Code tab), Claude Code 2.1.325
- macOS 27.2.1
- Regression: don't know
Related but different: #99767 (feature request for cross-window alerts).
Verified the minimal repro above as written (desktop 5.11492.5, engine 2.1.325). Note: the main window was showing a different session at the time, so the toast appeared over an unrelated conversation's transcript.