Add global shortcuts for opening Chat
Allow Ctrl+K and Alt+K to switch to Chat from any destination, while preserving terminal Ctrl+K behavior and focusing the active composer. Register the shortcuts in help and cover matching, navigation, terminal handling, and composer focus with regression tests.
This commit is contained in:
@@ -689,6 +689,13 @@ class _PipelinesAppState extends State<PipelinesApp>
|
||||
AppRoute? _chatWorkspaceRoute;
|
||||
Set<String>? _availableChatSessionIds;
|
||||
|
||||
/// After Ctrl+K or Alt+K shows Chat: the keyboard goes to the open chat's
|
||||
/// composer, if a chat is open.
|
||||
void _focusOpenChatComposer() {
|
||||
final id = _chatWorkspaceRoute?.chatSessionId;
|
||||
if (id != null) _chatRuntime.composerFocus.request(id);
|
||||
}
|
||||
|
||||
void _selectDestination(AppDestination destination) {
|
||||
final current = tabForRoute(_delegate.route);
|
||||
final last = _tabRoutes[destination];
|
||||
@@ -825,6 +832,7 @@ class _PipelinesAppState extends State<PipelinesApp>
|
||||
runningRunCount: counts.running,
|
||||
destination: _destinationOf(route.kind),
|
||||
onDestinationSelected: _selectDestination,
|
||||
onOpenChat: _focusOpenChatComposer,
|
||||
onClosePage: () => _delegate.goTo(
|
||||
_bodyRoutes[AppDestination.pipelines] ?? AppRoute.pipelines,
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user