Merge commit '06d3e23b796c81aeeef21b27d9cfeb0697845247' into pipelines/run-20261112-0129-desktop-navigation-rail-with-settings-9292
This commit is contained in:
@@ -13,6 +13,7 @@ import 'list_pane_widths.dart';
|
||||
import 'shell_bar.dart';
|
||||
import 'shell_chat_shortcut.dart';
|
||||
import 'shell_list_shortcuts.dart';
|
||||
import 'shell_runs_pipelines_shortcut.dart';
|
||||
import 'shell_search_shortcut_labels.dart';
|
||||
import 'tab_history.dart';
|
||||
import '../ui/input/keyboard_owner.dart';
|
||||
@@ -322,8 +323,9 @@ class _AdaptiveShellState extends State<AdaptiveShell> {
|
||||
}
|
||||
|
||||
/// App-wide search and conversation-list selection are handled before text
|
||||
/// fields. Split-pane navigation belongs to the chat workspace; tab changes
|
||||
/// have no global keyboard chord.
|
||||
/// fields. Split-pane navigation belongs to the chat workspace. Ctrl+A
|
||||
/// bounces between Runs and Pipelines, but leaves text fields and the
|
||||
/// terminal their own Ctrl+A (select all, line start).
|
||||
bool _handleDestinationKeyEvent(KeyEvent event) {
|
||||
final keyboard = HardwareKeyboard.instance;
|
||||
// Ctrl+K is the terminal's kill-line while the terminal has the keyboard;
|
||||
@@ -333,6 +335,13 @@ class _AdaptiveShellState extends State<AdaptiveShell> {
|
||||
if (event is KeyDownEvent) _openChat();
|
||||
return true;
|
||||
}
|
||||
if (shellRunsPipelinesShortcut(event, keyboard)) {
|
||||
if (primaryFocusTakesTyping()) return false;
|
||||
if (event is KeyDownEvent) {
|
||||
_select(shellRunsPipelinesTarget(_selected));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
// A terminal keeps its keys (Escape, Ctrl+/, Ctrl+digits).
|
||||
if (primaryFocusIsTypingSurface()) return false;
|
||||
if (_selected == AppDestination.search &&
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
import 'package:flutter/services.dart';
|
||||
|
||||
import 'destination.dart';
|
||||
|
||||
/// The chord that bounces between Runs and Pipelines, as the help page reads
|
||||
/// it. It is the same on every platform.
|
||||
const shellRunsPipelinesShortcutLabel = 'Ctrl+A';
|
||||
|
||||
/// Whether [event] is Ctrl+A. Only Ctrl counts: Alt, Shift, Cmd and chords
|
||||
/// with both Ctrl and Alt are not the shortcut. Repeats of a held chord match
|
||||
/// as well, so the caller can swallow them; only its first press acts.
|
||||
bool shellRunsPipelinesShortcut(KeyEvent event, HardwareKeyboard keyboard) {
|
||||
if (event is KeyUpEvent ||
|
||||
keyboard.isAltPressed ||
|
||||
keyboard.isShiftPressed ||
|
||||
keyboard.isMetaPressed ||
|
||||
!keyboard.isControlPressed) {
|
||||
return false;
|
||||
}
|
||||
return event.logicalKey == LogicalKeyboardKey.keyA;
|
||||
}
|
||||
|
||||
/// The destination Ctrl+A goes to from [current]: Pipelines from Runs, and
|
||||
/// Runs from every other destination (Pipelines included).
|
||||
AppDestination shellRunsPipelinesTarget(AppDestination current) =>
|
||||
current == AppDestination.runs
|
||||
? AppDestination.pipelines
|
||||
: AppDestination.runs;
|
||||
@@ -37,7 +37,7 @@ class WindowEntry {
|
||||
/// The saved frame; it is drawn fitted inside the window area.
|
||||
final Rect frame;
|
||||
|
||||
/// Hidden by its minimise button; still listed and shown again with its
|
||||
/// Hidden by the title bar's X; still listed and shown again with its
|
||||
/// group.
|
||||
final bool minimized;
|
||||
final bool maximized;
|
||||
|
||||
@@ -11,8 +11,9 @@ double windowTitleBarHeight(BuildContext context) =>
|
||||
MediaQuery.textScalerOf(context).scale(40).clamp(40.0, 64.0);
|
||||
|
||||
/// A floating window's card and title bar: the title (drag to move, double
|
||||
/// click to maximise), the kind's actions, then Minimise, Maximise and
|
||||
/// Close. The content is drawn over the card's body by the window's
|
||||
/// click to maximise), the kind's actions, then Maximise and the X. The X
|
||||
/// minimises: it hides the window and keeps its state, like the chord does
|
||||
/// in reverse. The content is drawn over the card's body by the window's
|
||||
/// navigator.
|
||||
class WindowFrame extends StatelessWidget {
|
||||
const WindowFrame({
|
||||
@@ -25,7 +26,6 @@ class WindowFrame extends StatelessWidget {
|
||||
required this.onMoveEnd,
|
||||
required this.onMinimize,
|
||||
required this.onToggleMaximized,
|
||||
required this.onClose,
|
||||
});
|
||||
|
||||
final String title;
|
||||
@@ -36,9 +36,10 @@ class WindowFrame extends StatelessWidget {
|
||||
/// The drag's delta and the pointer's global position.
|
||||
final void Function(Offset delta, Offset globalPosition) onMove;
|
||||
final VoidCallback onMoveEnd;
|
||||
|
||||
/// The X: hides the window, keeping it listed and its state.
|
||||
final VoidCallback onMinimize;
|
||||
final VoidCallback onToggleMaximized;
|
||||
final VoidCallback onClose;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -69,11 +70,6 @@ class WindowFrame extends StatelessWidget {
|
||||
onPressed: action.onPressed,
|
||||
icon: Icon(action.icon),
|
||||
),
|
||||
IconButton(
|
||||
tooltip: 'Minimise',
|
||||
onPressed: onMinimize,
|
||||
icon: const Icon(Icons.minimize),
|
||||
),
|
||||
IconButton(
|
||||
tooltip: maximized ? 'Restore size' : 'Maximise',
|
||||
onPressed: onToggleMaximized,
|
||||
@@ -82,8 +78,8 @@ class WindowFrame extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
IconButton(
|
||||
tooltip: 'Close',
|
||||
onPressed: onClose,
|
||||
tooltip: 'Minimise',
|
||||
onPressed: onMinimize,
|
||||
icon: const Icon(Icons.close),
|
||||
),
|
||||
const SizedBox(width: 4),
|
||||
|
||||
@@ -2,7 +2,7 @@ import 'package:flutter/widgets.dart';
|
||||
|
||||
import 'window_entry.dart';
|
||||
|
||||
/// One action in a window's title bar, before Minimise and Close (Dock on a
|
||||
/// One action in a window's title bar, before Maximise and the X (Dock on a
|
||||
/// chat, a kind's own menu).
|
||||
class WindowAction {
|
||||
const WindowAction({
|
||||
@@ -42,7 +42,7 @@ abstract class WindowKind {
|
||||
/// The window's content, below the title bar.
|
||||
Widget build(BuildContext context, WindowEntry entry);
|
||||
|
||||
/// Title-bar actions before Minimise and Close.
|
||||
/// Title-bar actions before Maximise and the X.
|
||||
List<WindowAction> actions(BuildContext context, WindowEntry entry) =>
|
||||
const [];
|
||||
|
||||
@@ -57,7 +57,7 @@ abstract class WindowKind {
|
||||
/// as its window takes focus. The default leaves it on the window.
|
||||
void focusContent(WindowEntry entry) {}
|
||||
|
||||
/// Called after the user closes the window (the X).
|
||||
/// Called after the window is closed (Dock, Close all, a chat's /close).
|
||||
void closed(WindowEntry entry) {}
|
||||
|
||||
/// Validates a saved window's [WindowEntry.data]; null drops the window.
|
||||
|
||||
@@ -259,7 +259,6 @@ class _WindowLayerState extends State<WindowLayer>
|
||||
onMinimize: () => manager.setMinimized(_id, true),
|
||||
onToggleMaximized: () =>
|
||||
manager.setMaximized(_id, !entry.maximized),
|
||||
onClose: () => manager.close(_id),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user