-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathkeybinds.py
More file actions
51 lines (36 loc) · 1.52 KB
/
keybinds.py
File metadata and controls
51 lines (36 loc) · 1.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
"""Key binding configuration for the Textual fixed TUI.
All bindings are hardcoded here. To change a key or its footer label,
edit the :class:`KeyBinds` dataclass fields directly — no JSON file needed.
"""
from __future__ import annotations
from dataclasses import dataclass
@dataclass(frozen=True)
class KeyBind:
"""A single key binding: a Textual key string and a short footer label."""
key: str
label: str
@dataclass(frozen=True)
class KeyBinds:
"""All keyboard shortcuts for the fixed TUI.
Every field is a :class:`KeyBind`. The ``key`` value is a Textual key
string (e.g. ``"ctrl+s"``, ``"pageup"``). The ``label`` is displayed in
the footer bar.
To remap a shortcut, change the ``key`` value here.
:class:`~agent.transports.tui_fixed.AarFixedApp` derives its ``BINDINGS``
from the module-level ``_KB`` instance automatically — no second edit needed.
"""
# Input
send: KeyBind = KeyBind("ctrl+s", "send")
history_prev: KeyBind = KeyBind("ctrl+up", "hist↑")
history_next: KeyBind = KeyBind("ctrl+down", "hist↓")
# Agent control
cancel: KeyBind = KeyBind("ctrl+x", "cancel")
# Navigation
scroll_up: KeyBind = KeyBind("pageup", "pg↑")
scroll_down: KeyBind = KeyBind("pagedown", "pg↓")
# View toggles
cycle_theme: KeyBind = KeyBind("ctrl+t", "theme")
toggle_thinking: KeyBind = KeyBind("ctrl+k", "think")
clear_screen: KeyBind = KeyBind("ctrl+l", "clear")
# Modals
toggle_log_viewer: KeyBind = KeyBind("ctrl+g", "logs")