Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/anki-code/xonsh-prewarmed
Run interactive xonsh shell session in milliseconds using prewarmed session from the background.
https://github.com/anki-code/xonsh-prewarmed
gnu-screen tmux tmux-plugin xonsh xontrib
Last synced: 28 days ago
JSON representation
Run interactive xonsh shell session in milliseconds using prewarmed session from the background.
- Host: GitHub
- URL: https://github.com/anki-code/xonsh-prewarmed
- Owner: anki-code
- License: apache-2.0
- Created: 2023-06-05T11:09:16.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-06-22T20:46:24.000Z (5 months ago)
- Last Synced: 2024-08-18T05:34:43.700Z (3 months ago)
- Topics: gnu-screen, tmux, tmux-plugin, xonsh, xontrib
- Language: Shell
- Homepage:
- Size: 41 KB
- Stars: 5
- Watchers: 1
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-xontribs - xonsh-prewarmed - run interactive xonsh session in milliseconds using prewarmed GNU Screen session from the background. (Integrations / Prompt tweaks)
README
xonsh-prewarmed is to run interactive xonsh session in milliseconds using prewarmed session from the background screen.
If you like the idea click ⭐ on the repo and and tweet.## How it works
On first run of `xonsh-prewarmed-*` script it creates additional reserved xonsh session in the background. On the next runs of the script it uses the reserved sessions and create new reserved sessions in the background. As result the speed of run the new interactive xonsh sessions is milliseconds.
Supported screen managers:
* [GNU Screen](https://www.gnu.org/software/screen/)
* [Tmux](https://github.com/tmux/tmux/wiki)## Installation
```xsh
wget https://raw.githubusercontent.com/anki-code/xonsh-prewarmed/main/xonsh-prewarmed-screen
wget https://raw.githubusercontent.com/anki-code/xonsh-prewarmed/main/xonsh-prewarmed-tmux
chmod +x xonsh-prewarmed-*
```## Usage
GNU Screen:
```xsh
./xonsh-prewarmed-screen
```
Tmux:
```xsh
./xonsh-prewarmed-tmux
```### Detect that xonsh was prewarmed
Use `XONSH_PREWARMED` environment variable to detect that xonsh was prewarmed in `~/.xonshrc`:
```xsh
if __xonsh__.env.get('XONSH_PREWARMED', False):
print('This xonsh session was prewarmed!')
```## Cheatsheet
### GNU Screen
Basics:
* When you run `screen` the new session will be started and your current terminal will be attached to it.
* You can put the screen session to background by pressing `Ctrl + a` and then press `d`. After this your terminal will be detached from the session but the session will stay active in background.
* Run `screen -ls` to get list of all sessions. The `sess_id` is the number before dot.
* Run `screen -r ` to attach `Detached` session to the current terminal.
* Run `screen -rd ` to detach the `Attached` session and attach to the current terminal.
* Run `env | grep STY` to get current `sess_id`.## Add another session manager
Feel free to add another session manager (e.g. `zellij`) by creating `xonsh-prewarmed-`.