Files
pipelines/app/lib/features/chat/conversation/chat_quick_switch_requests.dart
T
alan 141661e355 Chat: Ctrl+K / Alt+K on Chat opens a quick switcher for the open chats
On Chat the chord now toggles a centred dialog (bottom sheet on a phone)
with an autofocused filter over the open chats in list order; Ctrl+N/Down
and Ctrl+P/Up move the wrapping selection, Enter opens the chat as Ctrl+Tab
does (pane reused, composer focused), Esc or the chord closes it. From other
destinations the chord still jumps to Chat. Ctrl+N/Ctrl+P are handled so the
web page prevents their defaults (Ctrl+P no longer prints); a browser tab
keeps Ctrl+N reserved, documented in the help and notes/chat-quick-switch.md.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-02 12:27:39 +00:00

25 lines
738 B
Dart

import 'package:flutter/foundation.dart';
/// Where Ctrl+K / Alt+K pressed on the Chat destination goes: the mounted
/// chat screen attaches its quick switcher here, and the app toggles it.
class ChatQuickSwitchRequests {
VoidCallback? _toggle;
/// Makes [toggle] the switcher; the last attached one wins.
void attach(VoidCallback toggle) => _toggle = toggle;
/// Detaches [toggle] if it is still the attached one.
void detach(VoidCallback toggle) {
if (_toggle == toggle) _toggle = null;
}
/// Opens the switcher, or closes it when open. False when no chat screen
/// is mounted to show it.
bool toggle() {
final toggle = _toggle;
if (toggle == null) return false;
toggle();
return true;
}
}