App: open a chat, the terminal or a diff in a new window
"Open in new window" sits beside Float: the chat pane and chat list row menus, a floating chat window's title bar, the terminal options menu and the diff bar, plus Alt+Shift+Y for the chat with the keyboard (listed in the shortcut help). Once the window opens the item leaves the main window as Float takes a pane out of the tiling. The window is its own app instance at /window/chat/<id>, /window/terminal?tab=<key> or /window/diff/<token>: only that item, named after it, with "Bring back to main window". It has its own connection and writes no shared layout (no open-chat workspace, window store or terminal layout) and posts no notifications, so they stay the main window's. Web opens a popup window (a blocked popup offers a tab); Linux and macOS start a second process with --detached (Flutter's multi-window API is still experimental); Android and iOS hide the action. The capture kit gains a follow step for windows a page opens. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -25,6 +25,8 @@ mixin _ChatScreenFloat on State<ChatScreen>, _ChatScreenWorkspace {
|
||||
final pane = _workspace.activePane;
|
||||
if (pane != null) _floatPane(pane.id);
|
||||
},
|
||||
release: _releaseSession,
|
||||
activeSession: () => _workspace.activePane?.sessionId,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -66,6 +68,19 @@ mixin _ChatScreenFloat on State<ChatScreen>, _ChatScreenWorkspace {
|
||||
}
|
||||
}
|
||||
|
||||
/// [sessionId] went to a window of its own: its panes leave the tiling,
|
||||
/// as a floated pane does, and the list shows when none is left.
|
||||
void _releaseSession(String sessionId) {
|
||||
if (!mounted) return;
|
||||
final panes = _workspace.panes.where((p) => p.sessionId == sessionId);
|
||||
if (panes.isEmpty) return;
|
||||
for (final pane in panes.toList()) {
|
||||
_workspace.detach(pane.id);
|
||||
}
|
||||
_syncOpenWorkspace();
|
||||
if (_workspace.paneCount == 0) _back();
|
||||
}
|
||||
|
||||
void _dockSession(String sessionId) {
|
||||
if (!mounted) return;
|
||||
_workspaceVisible = true;
|
||||
@@ -75,15 +90,25 @@ mixin _ChatScreenFloat on State<ChatScreen>, _ChatScreenWorkspace {
|
||||
_composerFocus.request(sessionId);
|
||||
}
|
||||
|
||||
/// The pane menu's Float choice, on a tiled pane that can.
|
||||
/// The pane menu's Float choice, on a tiled pane that can, and Open in
|
||||
/// new window where the platform has windows.
|
||||
List<Widget> _floatControls(ChatWorkspacePane pane) {
|
||||
if (!_floatsHere || !_workspace.canFloat(pane.id)) return const [];
|
||||
final windows = widget.windows;
|
||||
if (windows == null || !_workspace.canFloat(pane.id)) return const [];
|
||||
return [
|
||||
ChatBarAction(
|
||||
label: 'Float (${chatFloatShortcutLabel()})',
|
||||
onPressed: () => _floatPane(pane.id),
|
||||
materialIcon: Icons.picture_in_picture_alt_outlined,
|
||||
),
|
||||
if (_floatsHere)
|
||||
ChatBarAction(
|
||||
label: 'Float (${chatFloatShortcutLabel()})',
|
||||
onPressed: () => _floatPane(pane.id),
|
||||
materialIcon: Icons.picture_in_picture_alt_outlined,
|
||||
),
|
||||
if (windows.detached != null)
|
||||
ChatBarAction(
|
||||
label: detachedChatWindowLabel(),
|
||||
identifier: 'chat-open-new-window',
|
||||
onPressed: () => windows.detach(pane.sessionId),
|
||||
materialIcon: Icons.open_in_browser,
|
||||
),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user