Basic Syntax
Comments
Lines starting with# are comments:
Command Structure
Commands are case-sensitive:String Literals
Strings can be quoted with double quotes, single quotes, or backticks:Duration Literals
Durations support standard Go duration formats:Mode Management
TUIOS has two primary modes: Window Management Mode and Terminal Mode.WindowManagementMode
Switch to window management mode for window operations.
TerminalMode
Switch to terminal mode to send input to the focused window.
Window Operations
NewWindow
Create a new terminal window in the current workspace.
CloseWindow
Close the currently focused window.
NextWindow
Focus the next window in the current workspace.
PrevWindow
Focus the previous window in the current workspace.
FocusWindow <id>
Focus a specific window by ID (advanced usage).
RenameWindow <name>
Rename the currently focused window.
MinimizeWindow
Minimize the currently focused window to the dock.
RestoreWindow
Restore a minimized window.
Tiling and Layout
ToggleTiling
Toggle tiling mode on/off for the current workspace.
EnableTiling
Explicitly enable tiling mode.
DisableTiling
Explicitly disable tiling mode.
SnapLeft
Snap the focused window to the left half of the screen.
SnapRight
Snap the focused window to the right half of the screen.
SnapFullscreen
Snap the focused window to fullscreen.
Workspace Management
TUIOS supports 9 workspaces (numbered 1-9).SwitchWorkspace <number>
Switch to a specific workspace (1-9).
MoveToWorkspace <number>
Move the focused window to another workspace (without following it).
MoveAndFollowWorkspace <number>
Move the focused window to another workspace and switch to it.
Keyboard Input
All keyboard input commands require Terminal Mode to be active.Type <text>
Type a string of text into the focused terminal.
Basic Keys
| Command | Description |
|---|---|
Enter | Press Enter |
Space | Press Space |
Tab | Press Tab |
Backspace | Press Backspace |
Delete | Press Delete |
Escape | Press Escape |
Navigation Keys
| Command | Description |
|---|---|
Up | Arrow up |
Down | Arrow down |
Left | Arrow left |
Right | Arrow right |
Home | Home key |
End | End key |
Key Combinations
Use+ to combine modifier keys with regular keys:
Ctrl- Control keyAlt- Alt/Option keyShift- Shift key
Timing and Synchronization
Sleep <duration>
Pause script execution for a specified duration.
Wait <duration>
Alternative syntax for waiting (alias for Sleep).
WaitUntilRegex <pattern> [timeout]
Wait until the terminal output matches a regex pattern (with optional timeout in milliseconds).
- Default: 5000ms (5 seconds)
- Specify custom timeout as second argument
Configuration Commands
SetConfig <path> <value>
Set a configuration option at runtime.
dockbar_position- Dockbar position:top,bottom,left,rightborder_style- Border style:rounded,normal,thick,double,hidden,block,asciianimations- Enable animations:true,false,togglehide_window_buttons- Hide window buttons:true,false
SetTheme <name>
Change the active theme.
SetDockbarPosition <position>
Change the dockbar position.
top, bottom, left, right, hidden
SetBorderStyle <style>
Change the window border style.
rounded, normal, thick, double, hidden, block, ascii, outer-half-block, inner-half-block
EnableAnimations
Enable UI animations.
DisableAnimations
Disable UI animations.
ToggleAnimations
Toggle UI animations on/off.
ShowNotification <message>
Display a notification message.
BSP Tiling Commands
Split <direction>
Split the focused window.
RotateSplit
Rotate split direction at focused window.
EqualizeSplits
Equalize all splits (reset to 50/50 ratios).
Preselect <direction>
Control where the next window spawns.
FocusDirection <direction>
Focus a window in a direction.
Advanced Commands
Set <key> <value>
Set a variable (for future use in scripting).
Output <file>
Specify output file (for future screenshot/recording features).
Source <file>
Include another tape file (for future use).
Best Practices
1. Always Add Sleeps After Actions
Give TUIOS time to process animations and state changes:2. Explicit Mode Switching
Always switch modes explicitly before performing mode-specific actions:3. Use Comments Generously
Document complex workflows:4. Workspace Organization
Use workspaces to group related windows:5. Consistent Timing
Use consistent sleep durations for similar actions:Complete Command Reference
Mode Commands
WindowManagementMode- Switch to window management modeTerminalMode- Switch to terminal mode
Window Commands
NewWindow- Create new windowCloseWindow- Close focused windowNextWindow- Focus next windowPrevWindow- Focus previous windowFocusWindow <id>- Focus specific window by IDRenameWindow <name>- Rename focused windowMinimizeWindow- Minimize focused windowRestoreWindow- Restore minimized window
Layout Commands
ToggleTiling- Toggle tiling modeEnableTiling- Enable tiling modeDisableTiling- Disable tiling modeSnapLeft- Snap to left halfSnapRight- Snap to right halfSnapFullscreen- Snap to fullscreen
Workspace Commands
SwitchWorkspace <n>- Switch to workspace (1-9)MoveToWorkspace <n>- Move window to workspaceMoveAndFollowWorkspace <n>- Move window and follow
Keyboard Commands
Type <text>- Type textEnter- Press EnterSpace- Press SpaceTab- Press TabBackspace- Press BackspaceDelete- Press DeleteEscape- Press EscapeUp,Down,Left,Right- Arrow keysHome,End- Navigation keysCtrl+<key>- Control key combinationsAlt+<key>- Alt key combinationsShift+<key>- Shift key combinations
Timing Commands
Sleep <duration>- Pause executionWait <duration>- Alias for SleepWaitUntilRegex <pattern> [timeout]- Wait for output pattern
Configuration Commands
SetConfig <path> <value>- Set configuration optionSetTheme <name>- Change themeSetDockbarPosition <pos>- Change dockbar positionSetBorderStyle <style>- Change border styleEnableAnimations- Enable animationsDisableAnimations- Disable animationsToggleAnimations- Toggle animationsShowNotification <msg>- Show notification
BSP Tiling Commands
Split <direction>- Split window (horizontal/vertical)RotateSplit- Rotate split directionEqualizeSplits- Equalize all splitsPreselect <direction>- Preselect spawn directionFocusDirection <direction>- Focus window by direction
Advanced Commands
Set <key> <value>- Set variable (future)Output <file>- Set output file (future)Source <file>- Include file (future)
Examples
Example 1: Basic Workflow
Example 2: Multi-Workspace Setup
Example 3: BSP Layout
Running Tape Scripts
Interactive Playback
Watch the script execute in real-time:Ctrl+P- Pause/resume playback
Remote Execution
Execute against a running session:Validation
Check syntax without running:Troubleshooting
Common Errors
“Unknown command”- Check spelling and capitalization (commands are case-sensitive)
- Check for missing quotes around strings
- Increase timeout or verify regex pattern matches expected output
Debugging Tips
- Check mode: Ensure you’re in the correct mode (Window Management vs Terminal)
- Add delays: Increase
Sleepdurations if actions are happening too fast - Validate syntax: Run
tuios tape validate script.tapeto check for errors - Test regex: Test regex patterns separately before using in
WaitUntilRegex
See Also
- CLI Flags Reference - Command-line options
- Keybindings Reference - Keyboard shortcuts
- Configuration Guide - TOML configuration options