anki-code / xonsh-prewarmed

Run interactive xonsh shell session in milliseconds using prewarmed session from the background.
Apache License 2.0
6 stars 1 forks source link
gnu-screen tmux tmux-plugin xonsh xontrib

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:

Installation

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:

./xonsh-prewarmed-screen

Tmux:

./xonsh-prewarmed-tmux

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

GNU Screen

Basics:

Add another session manager

Feel free to add another session manager (e.g. zellij) by creating xonsh-prewarmed-<manager>.