Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@bangedorrunt
Copy link
Contributor

Summary

  • implement YAML-driven startup layouts to automate window/pane creation in new sessions.
  • add --layout CLI flag and support for local (.prise.yml) and global (layout.yml) config files.
  • support built-in layouts (default, horizontal-split, vertical-split, dev) and variable expansion in commands.
  • document the new feature in prise(1) and prise(5) manpages.

This change introduces support for YAML-driven startup layouts, allowing users to define complex window and pane configurations that are automatically applied when starting a new session.

Key features:
- CLI support via --layout <name> flag.
- Configuration search order: --layout > local .prise.yml > global layout.yml > built-in.
- Built-in layouts: default, horizontal-split, vertical-split, dev.
- Support for multiple tabs (windows) and sequential pane splits within each tab.
- Variable expansion in commands (/Users/bangedorrunt, nano, /run/current-system/sw/bin/fish, , ).
- Integrated with the tiling UI to automatically spawn PTYS and execute commands.
@bangedorrunt
Copy link
Contributor Author

bangedorrunt commented Dec 19, 2025

Hi,
This is implementation for #63.
You could see the vibes at https://opncd.ai/share/ztXy3JiN

Please NOTE that this PR also merged #69

* Server: Add terminal_mutex locking when accessing PTY title and cwd to prevent data races.
* Client: Use absolute path for exec, ensure proper TTY deinitialization, and fix terminal reinitialization on failure.

The previous implementation allowed concurrent access to PTY state, leading to segfaults. Additionally, the exec call was using a relative path and leaving the TTY in an inconsistent state.
* Server: Fix missing lock in sendCwdChanged which caused a data race on PTY cwd state.
* Client: Implement a send queue to safely handle concurrent RPC sends. This prevents hangs when multiple PTYs are attached/initialized at once.
* Client: Ensure TTY thread is stopped and joined before performing exec during session switch.
* Client: Handle partial sends and queued messages correctly in onSendComplete.
* Client: Correctly map old PTY IDs to new ones in all Lua callbacks.
* Server: Added terminal_mutex locking when accessing PTY title and cwd to prevent data races.
* Client: Implemented an RPC send queue to handle concurrent requests safely and prevent hangs during session restoration.
* Client: Improved switchToSession reliability by ensuring TTY thread is stopped and joined before exec, and using absolute path for the executable.
* Client: Added pty_id_map to maintain UI consistency when PTYs are recreated with new IDs after a server restart.
* Lua: Fixed runtime errors in command palette caused by improper string conversion of dynamic command names.

The previous implementation had multiple race conditions in the server and lacked proper flow control in the client RPC layer, leading to segfaults and freezes during heavy I/O or session switching. Lua runtime errors further destabilized the UI during palette operations.
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.

1 participant