README.md
December 25, 2024 · View on GitHub
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.
Installation
git clone https://github.com/anki-code/xonsh-prewarmed
cd xonsh-prewarmed
chmod +x xonsh-prewarmed-*
Usage
./xonsh-prewarmed-screen
Tmux:
./xonsh-prewarmed-tmux
./xonsh-prewarmed-zellij
Detect that xonsh was prewarmed
Use XONSH_PREWARMED environment variable to detect that xonsh was prewarmed in ~/.xonshrc:
if __xonsh__.env.get('XONSH_PREWARMED', False):
print('This xonsh session was prewarmed!')
Cheatsheet
Share history between sessions
If you're using SQLite history backend in xonsh you can use history pull command to get history from other sessions.
GNU Screen
Basics:
- When you run
screenthe 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 + aand then pressd. After this your terminal will be detached from the session but the session will stay active in background. - Run
screen -lsto get list of all sessions. Thesess_idis the number before dot. - Run
screen -r <sess_id>to attachDetachedsession to the current terminal. - Run
screen -rd <sess_id>to detach theAttachedsession and attach to the current terminal. - Run
env | grep STYto get currentsess_id.
Add another session manager
Feel free to add another session manager (e.g. zellij) by creating xonsh-prewarmed-<manager>.