12c7642e35
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>
27 lines
848 B
Dart
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;
|
|
}
|
|
}
|