Make the terminal's floating mode a window of the window system

Phase 3 of docs/plans/floating-windows.md. The terminal window kind reuses
TerminalHub; TerminalWindows keeps the window in step with TerminalLayout
(show opens or shows it, hide minimises it, Minimise and Close hide the
terminal). The bottom panel stays a shell panel. The first window takes the
frame and maximised state pipelines.terminal-layout.v1 saved.

The terminal's own float chrome and FloatingLayer are deleted.
This commit is contained in:
2026-11-10 22:19:30 +00:00
parent 31f495fc18
commit 75a61dbd8c
15 changed files with 409 additions and 578 deletions
+13
View File
@@ -7,6 +7,8 @@ import '../features/terminal/terminal_layout.dart';
import '../features/terminal/terminal_machines.dart';
import '../features/terminal/terminal_surface.dart';
import '../features/terminal/terminal_toggle_button.dart';
import '../features/terminal/terminal_window.dart';
import '../shell/windows/window_manager.dart';
/// The app's machine terminals: one hub over every connected machine (the
/// chat pool's, else the app's own server), kept for the app's lifetime so
@@ -20,6 +22,7 @@ class AppTerminals {
required String machineId,
required String machineName,
required this.layout,
WindowManager? windows,
}) : machines = pool != null
? PoolTerminalMachines(pool)
: SingleTerminalMachines(
@@ -32,12 +35,20 @@ class AppTerminals {
),
) {
hub = TerminalHub(machines);
if (windows != null) {
floating = TerminalWindows(manager: windows, hub: hub, layout: layout)
..start();
}
}
final ValueNotifier<List<TerminalMachine>> machines;
final TerminalLayout layout;
late final TerminalHub hub;
/// The terminal's floating window in the app's window system; null
/// without one (the float mode then shows nothing).
TerminalWindows? floating;
/// [shell] with the terminal panel, window or page around it, and the
/// app's floating [windows] above both.
/// [onChat]: the phone shortcut that reopens the terminal shows on the
@@ -53,6 +64,7 @@ class AppTerminals {
cupertino: cupertino,
shortcutHere: onChat,
windows: windows,
floating: floating,
child: shell,
);
@@ -61,6 +73,7 @@ class AppTerminals {
TerminalToggleButton(layout: layout, cupertino: cupertino);
void dispose() {
floating?.dispose();
hub.dispose();
machines.dispose();
}
+13 -10
View File
@@ -265,16 +265,6 @@ class _PipelinesAppState extends State<PipelinesApp>
_session.addListener(_chatSyncChanged);
widget.chatPool?.addListener(_chatSyncChanged);
_chatSyncChanged();
// Every kind is registered: saved windows can be restored, then the
// floating chats an older build saved are brought over once.
unawaited(
_windows.restore().then((_) {
if (!mounted) return null;
return _chatWindows.migrate(
SharedPreferencesChatFloatStore(serverScope: chatScope),
);
}),
);
_terminals = AppTerminals(
pool: widget.chatPool,
connection: _session,
@@ -286,6 +276,19 @@ class _PipelinesAppState extends State<PipelinesApp>
widget.server.uri?.host ??
'This server',
layout: widget.terminalLayout ?? TerminalLayout.instance,
windows: _windows,
);
// Every kind is registered: saved windows can be restored. Then the
// terminal may open its window, and the floating chats an older build
// saved are brought over once.
unawaited(
_windows.restore().then((_) {
if (!mounted) return null;
_terminals.floating?.ready();
return _chatWindows.migrate(
SharedPreferencesChatFloatStore(serverScope: chatScope),
);
}),
);
_ownsProvider = widget.routeInformationProvider == null;
_provider =