Skip to content

Conversation

@jamesdowzard
Copy link

Summary

Expands the IPC system to expose ALL terminal actions (~50 total) and adds advanced screen dump capabilities.

This PR builds on the existing IPC foundation to enable comprehensive programmatic control of the terminal for automation, testing, and external integrations.

Changes

1. All Actions Exposed via IPC

  • ListActions now returns all ~50 actions from bindings/mod.rs
  • Includes: search, scrolling, tabs, splits, bookmarks, SSH profiles, snippets, broadcast mode, directory jumper, and more
  • Actions are documented with examples: selecttab(N), gotobookmark(N), run(COMMAND), etc.

2. Generic Action Execution

  • TriggerAction refactored to use Action::from(String) for universal action parsing
  • New execute_action() method in screen/mod.rs provides centralized action dispatch
  • Supports all action types with proper error handling for IPC-incompatible actions (Vi motions, hints, etc.)

3. JSON Screen Dumps

  • New ScreenDumpJson response format with structured cell data
  • Each cell includes: character, bold/italic/underline flags (colors coming in future update)
  • Enables rich terminal output analysis for testing and automation

4. Line Selection for Screen Dumps

  • DumpScreen now accepts start_line and end_line parameters
  • Supports both format: "text" (default) and format: "json"
  • Enables efficient partial screen dumps for large terminals

5. Tab Information

  • New ListTabs command returns array of tab metadata
  • Each tab includes: index, title, and is_current flag
  • Useful for multi-tab automation and state tracking

Files Changed

  • frontends/rioterm/src/ipc.rs: Updated command/response enums, added ScreenCell and TabInfo structs
  • frontends/rioterm/src/application.rs: Implemented DumpScreen format/line selection and ListTabs handler
  • frontends/rioterm/src/screen/mod.rs: Added comprehensive execute_action() method

Usage Examples

# List all available actions
midterm --list-actions

# Trigger any action
midterm --action createtab
midterm --action "selecttab(2)"
midterm --action "run(ls -la)"

# Dump screen as JSON with line range
midterm --dump-screen --format json --lines 0-10

# List all tabs
midterm --list-tabs

Testing

  • Build passes: cargo build -p rioterm
  • All action handlers delegate to existing screen methods
  • JSON serialization working for screen dumps and tab lists

Future Enhancements

  • Color information in JSON screen dumps (requires palette access)
  • Tab title extraction from context manager
  • Additional IPC commands for split management

Display battery percentage (macOS/Linux) and current time (HH:MM) in
the top-right corner of the tab bar. The status info is cached and
updated every 30 seconds to avoid expensive system calls on every frame.
- Icon now uses Rio's signature orange color scheme
- Welcome screen credits Rio Terminal with orange highlighting
- App metadata credits Raphael Amorim and rioterm.com
Two icon options saved:
- Option A: horizontal gradient line (pink→purple→cyan)
- Option B: three horizontal bars with Rio colours (red, yellow, cyan)

Currently using Option B as the dock icon.
- Session save/restore (Cmd+Shift+S/O)
- SSH profile manager (Cmd+G / Cmd+Shift+G)
- Snippets system (Cmd+/ / Cmd+Shift+N)
- Command completion notifications via OSC 133 shell integration
- Updated harness state tracking
- IPC system for programmatic terminal control via Unix socket
  - --action, --dump-screen, --status, --list-actions, --send, --wait-for CLI flags
  - TriggerAction, DumpScreen, GetStatus, ListActions, SendInput, ScreenContains commands

- Git status in tab titles (branch name + dirty indicator)
- Danger paste detection with confirmation dialogs
- Broadcast input mode (send to all splits simultaneously)
- Directory jumper with frecency-based sorting (Cmd+J)
Implemented comprehensive IPC expansion including:

1. **All Actions Exposed**: Updated ListActions to return all ~50 actions from bindings/mod.rs including search, scrolling, tabs, splits, bookmarks, SSH, snippets, broadcast mode, and directory jumper

2. **Generic Action Execution**: Refactored TriggerAction to use Action::from(String) for universal action parsing, with new execute_action() method in screen/mod.rs that handles all action types

3. **JSON Screen Dumps**: Added ScreenDumpJson response with structured cell data (character, bold, italic, underline flags) and optional line range selection

4. **Line Selection**: DumpScreen now supports start_line and end_line parameters for partial screen dumps

5. **Tab Information**: New ListTabs command returns tab index, title, and current status for all tabs

Changes:
- ipc.rs: Added ScreenCell, TabInfo structs; updated IpcCommand/IpcResponse enums; added JSON output handlers
- application.rs: Implemented comprehensive DumpScreen with format/line selection and ListTabs handler
- screen/mod.rs: Added execute_action() method with complete action dispatch for 50+ actions

This enables full programmatic control of the terminal via IPC for automation and testing.
@raphamorim
Copy link
Owner

hey thanks for the pr, but the pr is for your fork no? it even rename the app. Thanks for the pr 🙏

@raphamorim raphamorim closed this Jan 1, 2026
@jamesdowzard
Copy link
Author

Hey, you're right - sorry about that. I'm working on a personal fork called Midterm, just customising things for my own use. GitHub's PR UI defaulted to upstream and I didn't catch it before submitting.

I've now properly separated my fork so this won't happen again. If I do build anything useful that might benefit Rio, happy to share it with you to incorporate if you'd like.

I'm crediting Rio in my repo description as "Powered by Rio" and linking back to your repo. Let me know if you'd prefer a different attribution.

@raphamorim
Copy link
Owner

No stress with it! Best luck in the fork work btw 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants