Files
pipelines/app/lib/features/chat/conversation/chat_quick_switch_requests.dart
T
alan 12c7642e35 Chat quick switcher MRU, Closed section and markers; Alt+N, Alt+J and run tab keys
Ctrl+K lists open chats most recently used first (tracked on open and pane
focus, persisted per server) and preselects the previous chat, so Ctrl+K,
Enter returns to it. Rows mark needs you / working / unread; a query also
lists matching closed chats under Closed, and choosing one reopens it.
Alt+N (Option+N) starts a new chat and Alt+J (Option+J) opens the next chat
waiting for you, unread or failed, cycling; the terminal keeps both. In run
detail, bare 1-4 switch tabs when not typing. Cheatsheet entries added.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-03 00:49:36 +00:00

27 lines
848 B
Dart

import 'package:flutter/foundation.dart';
/// Where an app-wide chat shortcut goes: Ctrl+K / Alt+K pressed on the Chat
/// destination (the quick switcher), Alt+N (New chat) and Alt+J (the next
/// chat needing the operator). The mounted chat screen attaches its action
/// here, and the app runs 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;
}
}