In this post we will play with Alacritty in PopOS and then test it against GNOME terminal. But, what is Alacritty?
What is Alacritty?
Alacritty is the fastest terminal emulator in existence. Using the GPU for rendering enables optimizations that simply aren’t possible without it. Alacritty currently supports macOS, Linux, BSD, and Windows.From Alacritty GitHub
You can find Alacritty’s github page at https://github.com/alacritty/alacritty. So, Alacritty should be faster and lighter terminal emulator that your default GNOME Terminal. Because of that Alacritty will not have all functionalities of GNOME terminal. This post will describe how can you install Alacritty in Pop!_OS and check out is this terminal emulator for you.
Download source code
This is experiment for me, so I want to check out how hard is to download, compile and run Alacritty. I didn’t want to use snap image or something like that for this post.
So, let download the source code. For this we will need software version tool called git. Git is usually installed, but if it isn’t you can install it with next command:
sudo apt install git
Next just follow the instruction is installation page. We are following Manual Installation.
git clone https://github.com/alacritty/alacritty.git cd alacritty
And then we need to install Rust compiler with next command:
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
When asked to select installation option I selected Proceed with installation (default ) by inserting 1. After installation you need to make sure you have the right Rust compiler installed, and for that you can run next two commands:
rustup override set stable rustup update stable
But these commands will fail because we need to source one path. This is simply done for current terminal session by simply typing:
This is now the long time solution and better one is to add line above at the end of your .bashrc file-a.
Next, install couple of dependencies for Alacritty with:
apt-get install cmake pkg-config libfreetype6-dev libfontconfig1-dev libxcb-xfixes0-dev python3
Now we can build Alacritty.
To build Alacritty in Pop!_OS there is just one command that needs to be run for cloned alacritty git folder:
cargo build --release
After build, your alacritty binary should be located at ./target/release/alacritty and if we position in ./target/release folder we can start alacritty with:
and unconfigured alacritty should look something like this:
Check is terminfo installed with next command;
If not installed, install it with:
sudo tic -xe alacritty,alacritty-direct extra/alacritty.info
To create desktop entry and to update system path, we need to enter next commands:
sudo cp target/release/alacritty /usr/local/bin sudo cp extra/logo/alacritty-term.svg /usr/share/pixmaps/Alacritty.svg sudo desktop-file-install extra/linux/Alacritty.desktop sudo update-desktop-database
and let’s install man page as well with next commands:
sudo mkdir -p /usr/local/share/man/man1 gzip -c extra/alacritty.man | sudo tee /usr/local/share/man/man1/alacritty.1.gz > /dev/null
And last to finalize installation for bash shell we need to input one more command:
echo "source $(pwd)/extra/completions/alacritty.bash" >> ~/.bashrc
How do you configure Alacritty?
Of course we can configure Alacritty in PopOS very easily and make it look and work as we want. This is done by modifying the alacritty config file called alacritty.yml. Inside our cloned directory there is a example alacritty.yml config file, which is a great example on how this config file should look , and basically configuration is done by simply un commenting desired lines of code. But before we start changing this file we need to place it inside .config/alacritty directory, and only after we have config file ./config/alacritty/alacritty.yml we can notice changes. So, lets copy config file to .config/alacritty directory and take a look inside.
From config file we can determine that we have a lot of documentation via comment lines inside, and that the code is organized in section and the section configs. We can see that we have section env and window, and then we have section config TERM (inside env section) and dimensions(inside window section). In order to change dimensions we need to uncomment its section, in this case window.
I changed next:
window: # Window padding (changes require restart) # # Blank space added around the window in pixels. This padding is scaled # by DPI and the specified value is always added at both opposing sides. padding: x: 20 y: 20 decorations: full # Allow terminal applications to change Alacritty's window title. dynamic_title: true scrolling: # Maximum number of lines in the scrollback buffer. # Specifying '0' will disable scrolling. history: 99000 # Font configuration font: # Point size size: 10.0 # Background opacity # # Window opacity as a floating point number from `0.0` to `1.0`. # The value `0.0` is completely transparent and `1.0` is opaque. background_opacity: 0.85 cursor: # Cursor style style: # Cursor shape # # Values for `shape`: # - ▇ Block # - _ Underline # - | Beam shape: Beam # Cursor blinking state # # Values for `blinking`: # - Never: Prevent the cursor from ever blinking # - Off: Disable blinking by default # - On: Enable blinking by default # - Always: Force the cursor to always blink blinking: On live_config_reload: true
And of course you can play around with color scheme by simply editing the colors section in alacritty.yml file. I want to copy Pop!_OS scheme and my colors section looks something like:
# Colors (Tomorrow Night) colors: # Default colors primary: background: '#333333' foreground: '#F2F2F2' # Normal colors normal: black: '#263640' red: '#d12f2c' green: '#819400' yellow: '#b08500' blue: '#2587cc' magenta: '#696ebf' cyan: '#289c93' white: '#bfbaac' # Bright colors bright: black: '#4a697d' red: '#fa3935' green: '#a4bd00' yellow: '#d9a400' blue: '#2ca2f5' magenta: '#8086e8' cyan: '#33c5ba' white: '#fdf6e3'
Change default Terminal
In order to change default terminal emulator in Pop!_Os you simply need to enter next command in to terminal and select new default terminal from the list:
sudo update-alternatives --config x-terminal-emulator
With this Alacritty will open on a key-binding shortcut defined by Pop!_OS Super+T.
Ok, we configured our Alacritty in PopOS to look nice, but this is not main reason why we switched to this terminal emulator. This main reason was speed, lets do one test. Lets run next command:
time tree /
This command will list all files inside our root directory and we are timing it with time command. We will run this command inside Alacritty and inside GNOME terminal and compare times, so let start.
I run command in Alacritty, waited to finish and the run in GNOME terminal and the results are next, 23.330s for the Alacritty and 31.844s for the GNOME terminal. I run this test couple of time and every time Alacritty was faster, except once when Alacritty needed a full minute(don’t know why and didn’t happen again).
How do I uninstall Alacritty?
If you are reading this post, you had installed Alacritty from source and not from your distribution package repository. That means that you can not relay on your package manager, in this case Pop!_OS is using apt, to remove Alacritty. What you need to do is just reverse Installation process defined in previous chapter.
So, let’s remove last line from ours .bashrc file
Then let’s remove man page file from /usr/local/share/man/man1/alacritty.1.gz location.
Next, remove program files installed at /usr/local/bin/alacritty and application image from /usr/share/pixmaps/Alacritty.svg
you can delete Alacritty config files as well if you want to remove it completely. Remove directory alacrity from ~/.config directory.
The last thing to do if you want to remove alacrity source, go to your directory where you did git clone and remove alacritty directory as well.
We can continue even on. Let’s uninstall Rust compiler. PLEASE, be carefully with this is you have some more dependencies. But, if you used rust only for alacrity you can simply enter next command:
rustup self uninstall
Detailed documentation can be found on https://www.rust-lang.org/tools/install
Change default terminal to something that you have installed.
Ant that all on how to Install Alacritty in PopOS. You probably will now save much time in your daily activities by running Alacritty, but said that Alacirtty is faster and maybe more customizable terminal emulator. So, If you want to try something instead GNOME terminal, Alacritty should be on your short list.
Check out my other Pop!_OS related posts, and stay tuned because I’m preparing post on how to customize bash prompt with powerline and by editing .bashrc file. Stay entertained and see you in the next post.