XenoAtom.Terminal.UI provides a lightweight command system to make keyboard shortcuts discoverable and reusable across UI surfaces (key hints, command palette, menus).
Commands are retained-mode, registered on visuals (local) or on the TerminalApp (global), and routed using the same focus → parent traversal as other keyboard handling.
Screenshot placeholders will be added later.
A Command is an action with:
IdLabelMarkup (ANSI markup supported, including theme tokens like [primary])Gesture (single-stroke shortcut)Sequence (Ctrl+K Ctrl+P style multi-stroke shortcuts)CanExecute / IsVisible predicatesRegister commands directly on a control instance:
using XenoAtom.Terminal;
using XenoAtom.Terminal.UI.Controls;
using XenoAtom.Terminal.UI.Input;
var editor = new TextArea("Hello");
editor.AddCommand(new Command
{
Id = "App.Save",
LabelMarkup = "[primary]Save[/]",
Gesture = new XenoAtom.Terminal.UI.Input.KeyGesture(TerminalChar.CtrlS, TerminalModifiers.Ctrl),
Execute = _ => Terminal.WriteLine("Saved"),
});
Notes:
TerminalChar.CtrlX + TerminalModifiers.Ctrl (terminals commonly emit control characters).Gesture and Sequence are mutually exclusive.Use KeySequence to define sequences:
var cmd = new Command
{
Id = "App.CommandPalette",
LabelMarkup = "Command palette",
Sequence = new KeySequence(
new XenoAtom.Terminal.UI.Input.KeyGesture(TerminalChar.CtrlK, TerminalModifiers.Ctrl),
new XenoAtom.Terminal.UI.Input.KeyGesture(TerminalChar.CtrlP, TerminalModifiers.Ctrl)),
Execute = _ => Terminal.WriteLine("Open palette"),
};
By design, a gesture used as a sequence prefix should not also be used as a standalone command in the same scope.
Use CommandBar as part of your app chrome:
using XenoAtom.Terminal.UI.Controls;
var root = new DockLayout()
.Content(new TextArea())
.Bottom(new VStack(
new CommandBar(),
new Footer().Left("Tab focus | Mouse").Right("Ctrl+Q quit"))
.Spacing(0));
The command bar shows commands for the current focus context and clips when the line is full.
Commands have CommandPresentation flags (for example CommandBar, CommandPalette, Menu, ContextMenu).
CommandBar shows context-aware key hints for the focused visual.CommandPalette lists commands from the current focus context and global commands.MenuBar supports menu items backed by commands.CommandPresentation.ContextMenu.While a modal popup/menu is active, global shortcuts are not executed “behind” it.