# terminus-persistence A minimal Sublime Text plugin that remembers whether your Terminus panel was open between sessions and automatically restores it. ## Features - **Automatic State Persistence**: Remembers if Terminus was open when you closed Sublime Text - **Seamless Restoration**: Automatically reopens Terminus on startup if it was previously open - **Convenient Menu Integration**: Quick access to Terminus controls via View menu - **Configurable**: Toggle persistence on/off as needed ## Requirements - Sublime Text 3 or 4 - [Terminus](https://packagecontrol.io/packages/Terminus) plugin installed ## Installation ### Via Package Control 1. Open Command Palette (`Ctrl+Shift+P` / `Cmd+Shift+P`) 2. Select "Package Control: Install Package" 3. Search for "terminus-persistence" 4. Press Enter to install ## Usage ### Automatic Behavior Once installed, the plugin works automatically: 1. Open Terminus panel (via `Alt+\`` or Terminus commands) 2. Close Sublime Text 3. Reopen Sublime Text 4. Terminus panel will automatically reopen ### Menu Commands Access via **View → Terminus**: - **Toggle Persistence**: Enables or disables automatic persistence (shows checkmark when enabled) ### Command Palette All commands are available via the Command Palette (`Ctrl+Shift+P` / `Cmd+Shift+P`): - **terminus-persistence: Toggle Persistence** - Enable or disable persistence - **Preferences: terminus-persistence Settings** - Open settings in split view ## Configuration Settings can be accessed via: - **Menu**: `Preferences → Package Settings → terminus-persistence → Settings` - **Command Palette**: `Preferences: terminus-persistence Settings` Default settings: ```json { // Enable or disable automatic persistence of Terminus panel state "persistence_enabled": true } ``` ## How It Works 1. **On Close**: When you close a Sublime Text window, the plugin checks if a Terminus panel is visible 2. **State Storage**: The visibility state is saved to a JSON file in your User directory 3. **On Startup**: When Sublime Text loads, the plugin waits 1 second (to ensure Terminus is loaded) then restores the panel state 4. **Configurable**: Persistence can be toggled on/off via the View menu ### Files Created The plugin creates the following files in your Sublime Text User directory (`Packages/User/`): - **`terminus_persistence_state.json`**: Stores the panel visibility state between sessions - Contains: `terminus_was_visible` (boolean) and `terminus_panel_name` (string or null) - This file is automatically created and updated when you close Sublime Text - Safe to delete - will be recreated on next close ## Troubleshooting ### Terminus doesn't reopen on startup - Make sure Terminus plugin is installed and enabled - Check that persistence is enabled: View → Terminus → Toggle Persistence (should show checkmark) - Try increasing the delay in `plugin_loaded()` if Terminus loads slowly ### Menu items don't appear - Ensure the folder is named exactly `terminus-persistence` - Restart Sublime Text - Check Console for errors (View → Show Console) ## Development ### Project Structure ``` terminus-persistence/ ├── terminus_persistence.py # Main plugin code ├── terminus-persistence.sublime-settings # Default settings ├── terminus-persistence.sublime-commands # Command palette entries ├── Main.sublime-menu # Menu integration ├── messages.json # Installation message config ├── messages/ │ └── install.txt # Post-install message └── README.md # This file ``` ### Testing 1. Enable Sublime Text console: View → Show Console 2. Open Terminus panel 3. Close and reopen Sublime Text 4. Check console for any errors 5. Verify Terminus reopens automatically ### Contributing Contributions are welcome! Please feel free to submit issues or pull requests. ## License MIT License - See LICENSE file for details ## Author Gabriel Lody ## Acknowledgments - [Terminus](https://github.com/randy3k/Terminus) by randy3k - The excellent terminal emulator this plugin extends - Sublime Text community ## Changelog ### 0.1.1 - Add Command Palette support - Add settings menu with split view (edit_settings) - Add .gitattributes for clean package distribution - Remove obsolete state data from settings file - Update documentation ### 0.1.0 (Initial Release) - Basic persistence functionality - View menu integration - Toggle persistence on/off - Automatic state restoration