Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generalize keyboard navigation for demo apps #675

Merged
merged 13 commits into from
Nov 8, 2024
20 changes: 14 additions & 6 deletions doc/apps.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,8 @@ TerminalOutput | x | Direct output the `data=` value
TerminalSendKey | x | Simulating keypresses using the `data=` string.
TerminalQuit | | Terminate runnning console apps and close terminal.
TerminalRestart | | Terminate runnning console apps and restart current session.
TerminalFullscreen | | Toggle fullscreen mode.
TerminalToggleFullscreen | | Toggle fullscreen mode.
TerminalToggleMaximize | | Toggle between maximized and normal window size.
TerminalUndo | | (Win32 Cooked/ENABLE_LINE_INPUT mode only) Discard the last input.
TerminalRedo | | (Win32 Cooked/ENABLE_LINE_INPUT mode only) Discard the last Undo command.
TerminalClipboardPaste | | Paste from clipboard.
Expand Down Expand Up @@ -170,6 +171,9 @@ The list of hotkey actions is slightly different from the list of window menu ac

Value | Unique for hotkeys | Default Hotkey | Description
-----------------------------|--------------------|------------------------------|------------
Drop | | | Drop all events for the specified key combination. No further processing.
DropIfRepeats | | | Drop `Key Repeat` events for the specified key combination. This binding should be specified before the main action for the key combination.
ToggleExclusiveKeybd | x | `Ctrl-Alt`, `Alt-Ctrl` | Toggle exclusive keyboard mode. In exclusive mode, all keyboard events are ignored by higher levels.
TerminalFindNext | | `Alt+RightArrow` | Highlight next match of selected text fragment. Clipboard content is used if no active selection.
TerminalFindPrev | | `Alt+LeftArrow` | Highlight previous match of selected text fragment. Clipboard content is used if no active selection.
TerminalViewportOnePageUp | x | `Shift+Ctrl+PageUp` | Scroll one page up.
Expand All @@ -188,16 +192,17 @@ TerminalClipboardWipe | |
TerminalUndo | | | (Win32 Cooked/ENABLE_LINE_INPUT mode only) Discard the last input.
TerminalRedo | | | (Win32 Cooked/ENABLE_LINE_INPUT mode only) Discard the last Undo command.
TerminalToggleCwdSync | x | | Toggle the current working directory sync mode.
TerminalToggleWrapMode | x | | Toggle terminal scrollback lines wrapping mode. Applied to the active selection if it is. The argument is boolean.
TerminalToggleSelectionMode | x | | Toggle between linear(0) and rectangular(1) selection form.
TerminalToggleWrapMode | x | | Toggle terminal scrollback lines wrapping mode. Applied to the active selection if it is.
TerminalToggleSelectionMode | x | | Toggle between linear and rectangular selection form.
TerminalToggleFullscreen | x | | Toggle fullscreen mode.
TerminalToggleMaximize | x | | Toggle between maximized and normal window size.
TerminalToggleStdioLog | x | | Stdin/stdout log toggle.
TerminalQuit | | | Terminate runnning console apps and close terminal.
TerminalRestart | | | Terminate runnning console apps and restart current session.
TerminalSwitchCopyMode | x | | Set terminal text selection mode. The argument can be the one of the following values 0:'none', 1:'text', 2:'ansi', 3:'rich', 4:'html', 5:'protected'.
TerminalSwitchCopyMode | x | | Switch terminal text selection mode.
TerminalSelectionCopy | | | Сopy selection to clipboard.
TerminalSelectionCancel | | `Esc` | Deselect a selection.
TerminalSelectionOneShot | | | One-shot toggle to copy text while mouse tracking is active. Keep selection if `Ctrl` key is pressed.<br>The `data=` attribute can have the following values `none`, `text`, `ansi`, `rich`, `html`, `protected`.
TerminalSelectionOneShot | | | One-shot toggle to copy text while mouse tracking is active. Keep selection if `Ctrl` key is pressed.

#### Terminal configuration example
```xml
Expand Down Expand Up @@ -279,7 +284,7 @@ TerminalSelectionOneShot | |
<item label="Undo" type="Command" action=TerminalUndo/>
<item label="Redo" type="Command" action=TerminalRedo/>
<item label="Quit" type="Command" action=TerminalQuit/>
<item label="Fullscreen" type="Command" action=TerminalFullscreen/>
<item label="Fullscreen" type="Command" action=TerminalToggleFullscreen/>

<item label="Hello, World!" notes=" Simulating keypresses " action=TerminalSendKey data="Hello World!"/>
<item label="Push Me" notes=" test " type="Repeat" action=TerminalOutput data="pressed ">
Expand Down Expand Up @@ -331,13 +336,16 @@ TerminalSelectionOneShot | |
<key="" action=TerminalToggleWrapMode/> <!-- Toggle terminal scrollback lines wrapping mode. Applied to the active selection if it is. The argument is boolean. -->
<key="" action=TerminalToggleSelectionMode/> <!-- Toggle between linear(0) and rectangular(1) selection form. -->
<key="" action=TerminalToggleFullscreen/> <!-- Toggle fullscreen mode. -->
<key="" action=TerminalToggleMaximize/> <!-- Toggle between maximized and normal window size. -->
<key="" action=TerminalToggleStdioLog/> <!-- Stdin/stdout log toggle. -->
<key="" action=TerminalQuit/> <!-- Terminate runnning console apps and close terminal. -->
<key="" action=TerminalRestart/> <!-- Terminate runnning console apps and restart current session. -->
<key="" action=TerminalSwitchCopyMode/> <!-- Set terminal text selection mode. The argument can be the one of the following values 0:'none', 1:'text', 2:'ansi', 3:'rich', 4:'html', 5:'protected'. -->
<key="" action=TerminalSelectionCopy/> <!-- Сopy selection to clipboard. -->
<key="Esc" action=TerminalSelectionCancel/> <!-- Deselect a selection. -->
<key="" action=TerminalSelectionOneShot/> <!-- One-shot toggle to copy text while mouse tracking is active. Keep selection if 'Ctrl' key is pressed. The argument can be the one of the following values 0:'none', 1:'text', 2:'ansi', 3:'rich', 4:'html', 5:'protected'. -->
<key="Ctrl-Alt" action=ToggleExclusiveKeybd/> <!-- Toggle exclusive keyboard mode by pressing and releasing Ctrl-Alt. -->
<key="Alt-Ctrl" action=ToggleExclusiveKeybd/> <!-- Toggle exclusive keyboard mode by pressing and releasing Alt-Ctrl. -->
</hotkeys>
</term>
</config>
Expand Down
23 changes: 23 additions & 0 deletions doc/settings.md
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,24 @@ Tag | Value
`key` | The text string containing the key combination.
`action` | The action name.

The following joiners are allowed for combining keys:

Joiner | Meaning
-------|--------
`+` | The subsequent key is in pressed state.
`-` | The subsequent key is in released state. This joiner is allowed for the last key only.

Key combinations can be of the following types:

Type | Example |Description
------------|------------------------|-----------
`Generic` | `Ctrl+A` | A generic key combination without distinction left/right and numpad.
`Literal` | `Alt+'a'` | A generic key combination without distinction left/right and numpad, except for the last key represented as a single-quoted character/string generated by the key.
`Specific` | `LeftShift+RightShift` | A key combination with explicitly specified physical keys.
`Scancodes` | `0x3B+0x3C` | A key combination represented solely by scan codes of physical keys in hexadecimal format.

Generic, literal and specific key sequences can be mixed in any order.

The required key combination sequence can be generated on the Info page, accessible by clicking on the label in the lower right corner of the vtm desktop.

#### Interpretation
Expand All @@ -327,6 +345,7 @@ Action | Default key combination | Available at level
-------------------------------|--------------------------|---------------------|------------
`Drop` | | All levels | Drop all events for the specified key combination. No further processing.
`DropIfRepeats` | | All levels | Drop `Key Repeat` events for the specified key combination. This binding should be specified before the main action for the key combination.
`ToggleExclusiveKeybd` | `Ctrl-Alt`, `Alt-Ctrl` | Application | Toggle exclusive keyboard mode. In exclusive mode, all keyboard events are ignored by higher levels. Exclusive keyboard mode is automatically disabled when refocusing.
`IncreaseCellHeight` | `CapsLock+UpArrow` | Native GUI window | Increase the text cell height by one pixel.
`DecreaseCellHeight` | `CapsLock+DownArrow` | Native GUI window | Decrease the text cell height by one pixel.
`ResetCellHeight` | `Ctrl+Key0` | Native GUI window | Reset text cell height.
Expand Down Expand Up @@ -359,6 +378,7 @@ Action | Default key combination | Available at level
`TerminalToggleWrapMode` | | Application | Toggle terminal scrollback lines wrapping mode. Applied to the active selection if it is.
`TerminalToggleSelectionMode` | | Application | Toggle between linear and rectangular selection form.
`TerminalToggleFullscreen` | | Application | Toggle fullscreen mode.
`TerminalToggleMaximize` | | Application | Toggle between maximized and normal window size.
`TerminalToggleStdioLog` | | Application | Stdin/stdout log toggle.
`TerminalQuit` | | Application | Terminate runnning console apps and close terminal.
`TerminalRestart` | | Application | Terminate runnning console apps and restart current session.
Expand Down Expand Up @@ -805,13 +825,16 @@ Notes
<key="" action=TerminalToggleWrapMode/> <!-- Toggle terminal scrollback lines wrapping mode. Applied to the active selection if it is. -->
<key="" action=TerminalToggleSelectionMode/> <!-- Toggle between linear and rectangular selection form. -->
<key="" action=TerminalToggleFullscreen/> <!-- Toggle fullscreen mode. -->
<key="" action=TerminalToggleMaximize/> <!-- Toggle between maximized and normal window size. -->
<key="" action=TerminalToggleStdioLog/> <!-- Stdin/stdout log toggle. -->
<key="" action=TerminalQuit/> <!-- Terminate runnning console apps and close terminal. -->
<key="" action=TerminalRestart/> <!-- Terminate runnning console apps and restart current session. -->
<key="" action=TerminalSwitchCopyMode/> <!-- Switch terminal text selection copy mode. -->
<key="" action=TerminalSelectionCopy/> <!-- Сopy selection to clipboard. -->
<key="Esc" action=TerminalSelectionCancel/> <!-- Deselect a selection. -->
<key="" action=TerminalSelectionOneShot/> <!-- One-shot toggle to copy text while mouse tracking is active. Keep selection if 'Ctrl' key is pressed. -->
<key="Ctrl-Alt" action=ToggleExclusiveKeybd/> <!-- Toggle exclusive keyboard mode by pressing and releasing Ctrl-Alt. -->
<key="Alt-Ctrl" action=ToggleExclusiveKeybd/> <!-- Toggle exclusive keyboard mode by pressing and releasing Alt-Ctrl. -->
</hotkeys>
</term>
<defapp>
Expand Down
25 changes: 13 additions & 12 deletions doc/user-interface.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,19 @@
</thead>
<tbody>
<tr>
<th>F10</th>
<th>Ctrl-Alt ²</th>
<td colspan="9">Toggle exclusive keyboard mode</td>
</tr>
<tr>
<th>F10 ²</th>
<td colspan="9">Disconnect all users and shutdown if there are no apps running</td>
</tr>
<tr>
<th>Shift+F7</th>
<th>Shift+F7 ²</th>
<td colspan="9">Leave current session</td>
</tr>
<tr>
<th>Ctrl+PgUp/PgDn</th>
<th>Ctrl+PageUp/PageDown ²</th>
<td colspan="9">Switch focus between running apps</td>
</tr>
<tr>
Expand Down Expand Up @@ -162,19 +166,19 @@
</thead>
<tbody>
<tr>
<th>Alt+Enter</th>
<th>Alt+Enter ²</th>
<td colspan="3">Toggle fullscreen mode</td>
</tr>
<tr>
<th>Ctrl+CapsLock</th>
<th>Ctrl+CapsLock ²</th>
<td colspan="3">Toggle antialiasing mode</td>
</tr>
<tr>
<th>CapsLock+Up/DownArrow</th>
<th>CapsLock+UpArrow/DownArrow ²</th>
<td colspan="3">Scale cell size</td>
</tr>
<tr>
<th>CapsLock+0</th>
<th>CapsLock+0 ²</th>
<td colspan="3">Reset cell size</td>
</tr>
<tr>
Expand All @@ -189,10 +193,6 @@
<th>DoubleLeftClick</th>
<td colspan="3">Toggle fullscreen mode (if unhandled)</td>
</tr>
<tr>
<th>Home+End</th>
<td colspan="3">Close GUI window</td>
</tr>
<tr>
<th>AnyDrag<br>Left+RightDrag</th>
<td colspan="1">Move GUI window (if unhandled)</td>
Expand All @@ -214,4 +214,5 @@
</tbody>
</table>

¹ — In fullscreen mode, the GUI window reserves a 1px high area at the top for forwarding mouse events.
¹ — In fullscreen mode, the GUI window reserves a 1px high area at the top for forwarding mouse events.
² — Key bindings can be customized using the settings.
Loading
Loading