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.
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:
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-*
GNU Screen:
./xonsh-prewarmed-screen
Tmux:
./xonsh-prewarmed-tmux
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!')
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 pressd
. 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. Thesess_id
is the number before dot. - Run
screen -r <sess_id>
to attachDetached
session to the current terminal. - Run
screen -rd <sess_id>
to detach theAttached
session and attach to the current terminal. - Run
env | grep STY
to get currentsess_id
.
Feel free to add another session manager (e.g. zellij
) by creating xonsh-prewarmed-<manager>
.