I finally got my sway layout to autostart the way I like it
2 months ago
- #Automation
- #Window Management
- #Sway
- User struggled with automated save and restore of running applications in Sway, unlike KDE.
- Experiments with Claude Code for automated session startup were unsuccessful due to race conditions.
- Discovered a solution in Sway's manpages: tracking window creation via process pid.
- New approach: spawn all windows at once, then rearrange them, solving race conditions and speeding up startup.
- Initial prototype had issues with layout hierarchy and process metadata, which were manually fixed.
- Developed 'sway-layout', a tool to automate window layout in Sway, written in Go for easy deployment.
- Example JSON config provided for defining nested window layouts in Sway.
- Current limitations include no tracking for detached processes and fixed window sizes within splits.
- Future work could include real-time layout tracking and automated save/restore functionality.