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:
2026-12-03 12:47:42 +00:00
parent c4de1de27b
commit 61c7eee2b0
46 changed files with 3223 additions and 72 deletions
@@ -0,0 +1,65 @@
import 'package:flutter/services.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:pipelines_app/features/chat/workspace/chat_float_shortcut.dart';
import 'package:pipelines_app/features/settings/keyboard_shortcuts_registry.dart';
import 'package:pipelines_app/shell/detached/detached_window_scope.dart';
void main() {
testWidgets('Alt+Shift+Y is the new-window chord, never Float', (
tester,
) async {
final seen = <(bool detach, bool float)>[];
bool handler(KeyEvent event) {
if (event is KeyDownEvent &&
event.logicalKey == LogicalKeyboardKey.keyY) {
final keyboard = HardwareKeyboard.instance;
seen.add((
detachedWindowShortcut(event, keyboard),
chatFloatShortcut(event, keyboard),
));
}
return false;
}
HardwareKeyboard.instance.addHandler(handler);
addTearDown(() => HardwareKeyboard.instance.removeHandler(handler));
Future<void> chord(List<LogicalKeyboardKey> modifiers) async {
for (final key in modifiers) {
await tester.sendKeyDownEvent(key);
}
await tester.sendKeyEvent(LogicalKeyboardKey.keyY);
for (final key in modifiers.reversed) {
await tester.sendKeyUpEvent(key);
}
}
await chord([LogicalKeyboardKey.altLeft, LogicalKeyboardKey.shiftLeft]);
await chord([LogicalKeyboardKey.altLeft]);
await chord([LogicalKeyboardKey.shiftLeft]);
await chord([
LogicalKeyboardKey.controlLeft,
LogicalKeyboardKey.altLeft,
LogicalKeyboardKey.shiftLeft,
]);
expect(seen, [
(true, false),
(false, true),
(false, false),
(false, false),
]);
});
test('the shortcut help lists it where windows exist', () {
String? keysOn(TargetPlatform platform, {bool web = false}) =>
KeyboardShortcutRegistry(platform: platform, web: web).entries
.where((e) => e.action == 'Open the chat in a new window')
.map((e) => e.keys)
.firstOrNull;
expect(keysOn(TargetPlatform.linux), 'Alt+Shift+Y');
expect(keysOn(TargetPlatform.macOS), 'Option+Shift+Y');
expect(keysOn(TargetPlatform.windows, web: true), 'Alt+Shift+Y');
expect(keysOn(TargetPlatform.android), isNull);
expect(keysOn(TargetPlatform.iOS), isNull);
});
}