To try it, it’s as simple as:
sudo pip install butterfly #Install butterfly
butterfly.server.py # Launch the web server
Then all you have to do is go to : localhost:57575
Run at start-up with systemd
As it relies on a server running in background, you can download the systemd file from here butterfly.service put it in
/etc/systemd/system/ or equivalent and:
sudo systemctl enable butterfly
sudo systemctl start butterfly
Now the server will always be running.
Running as root and multiple users
butterfly is made to work as the terminal user and as root. When running as root the privileges are dropped to the user that initiated the connection, i.e. the user that opened the web page. You can change the terminal user by going to localhost:57575/user/<user>.
Access from a remote machine
You can set the bind host with
butterfly.server.py --host="0.0.0.0" which will allow other users to connect to your terminal. A password will be asked but IT IS NOT SECURE! So it’s recommended as of now to run this only on local network for testing purposes.
Run a specific shell
Use the shell command line option:
butterfly works like any other terminal but it has some specific features.
Enter browser shortcuts
When the terminal is focused all the hot-keys are caught (except from those the browser prevent to catch). If you want to access the address bar with CTRL + L it won’t work. That why the ALT + Z combination is here to tell butterfly that the next key combination must not be caught. In other word accessing the address bar is done by doing ALT + Z then CTRL + L. (If your browser support css3 filters the screen will turn sepia).
Quick selection of history text
This is a feature I’ve always wanted to find in a terminal, quick history selection. I’ve started to implement some ideas you can try by hitting CTRL + SHIFT + up and then navigating the selection with CTRL + SHIFT + up/down and the arrow keys. When you got it right, hit ENTER and butterfly will enter the selection right into the prompt:
- The visual style is done using css so it’s entirely editable.
- As apparently it’s trendy to use a “modern” text editor based on a browser, so…
- The scroll-back is actually limited to 100 000 lines as of now in order to limit the memory footprint. It would be a good idea to store the scroll-back on the disk using the server.
- Embedding html directly into the terminal is possible and partially supported with the
ESC]99;<html>BELLcommand. It can lead to some interesting features.
- 16.7 millions of color is not yet supported but it’s one hack away using the
- An in-terminal css/js editing options with why not a package repository for theme and extensions.
So let me know what do you think of it, I had a lot of fun writing it anyway.