Alacritty
Alacritty is a terminal emulator focused on simplicity and performance. The performance goal means it should[1] be faster than any other terminal emulators available. The simplicity goal means it does not have features such as tabs or splits (which can be provided by some window managers, or terminal multiplexers)[2].
Alacritty is written in Rust and GPU-accelerated using OpenGL.
USE flags
USE flags for x11-terms/alacritty GPU-accelerated terminal emulator
Installation
Emerge
Install x11-terms/alacritty package:
root #
emerge --ask x11-terms/alacritty
Configuration
Files
alacritty does not automatically create or install a configuration file, but it will search for one in the following locations:
- $XDG_CONFIG_HOME/alacritty/alacritty.yml
- $XDG_CONFIG_HOME/alacritty.yml
- $HOME/.config/alacritty/alacritty.yml
- $HOME/.alacritty.yml
Configuration files with currently supported values are provided with each upstream release. On Gentoo, depending on the version installed, the file can be found in the following location. Be sure to adjust the PV
( package version) value to align with whatever version is currently installed on the system.
Since only one copy of alacritty can be installed at a time, use a wildcard to reference the documentation directory for it:
/usr/share/doc/alacritty-*/
The default configuration can be created in a users' home directory with the following commands:
user $
mkdir --parents ~/alacritty
user $
bzcat /usr/share/doc/alacritty-${PV}/alacritty.yml.bz2 > ~/alacritty/alacritty.yml
The configuration file is YAML-formatted. Preserving the indentation is critical (YAML is indentation sensitive!). The configuration file uses the TOML format since version 0.13.0
By default alacritty will reload the configuration automatically when changes have been written into the file. This behavior can be disabled with the following invocation:
user $
alacritty --no-live-config-reload
This can also be disabled via the configuration file:
# Live config reload (changes require restart)
live_config_reload: false
The configuration file should be downloaded and edited from the repository's release page. Explanations are provided in the configuration file.
Make sure, that the adapted configuration file is compatible with the current installation of Alacritty. It might be, that version differences cause compatibility issues.
Migration from YAML to TOML
Since since version 0.13.0, the TOML configuration format is used by alacritty. Users with an existing YAML configuration can use the migrate subcommand to convert their current configuration:
user $
alacritty migrate
Font configuration
One can run the following command and copy the desired font name:
user $
fc-list -f '%{family}\n' | awk '!x[$0]++'
Changing the default font by editing the config file.
# Font configuration (changes require restart)
font:
# The normal (roman) font face to use.
normal:
family: Hack
# Style can be specified to pick a specific face.
style: Regular
# The bold font face
bold:
family: Hack
# Style can be specified to pick a specific face.
# style: Bold
# The italic font face
italic:
family: Hack
# Style can be specified to pick a specific face.
# style: Italic
size: 11.0
This will change the font to one provided by media-fonts/hack, given that the package is installed.
This method uses defaults for all other settings.
Colors configuration
The easiest way is to code Alacritty theme directory and include the relevant theme :
user $
mkdir -p ~/.config/alacritty/themes
user $
git clone --branch yaml https://github.com/alacritty/alacritty-theme ~/.config/alacritty/themes
The latest version uses the toml file format, so we need to use the yaml branch.
For example, with Gruvbox Light:
import:
~/.config/alacritty/themes/gruvbox_light.yaml
More schemes can be found from this page: alacritty Wiki of Color schemes.
Transparent background
window:
opacity: 0.8
Configuration with tabbed
Since Alacritty does not support tabs intentionally[3], one can use x11-misc/tabbed:
user $
tabbed -r 2 alacritty --embed ""
See the man page for more information;
user $
man 1 tabbed
Troubleshooting
Using fcitx
This needs app-i18n/fcitx and x11-wm/i3 installed. The initialization file should look like this:
export GTK_IM_MODULE=fcitx
export QT_IM_MODULE=fcitx
export XMODIFIERS="@im=fcitx"
eval "$(dbus-launch --sh-syntax --exit-with-session)"
exec i3
The most important thing is to start i3 last.
Colorful LS
The output of
ls
(should) be colorful by default, so this is optional.
To modify ls
to have colorful output, add the following in /etc/DIR_COLORS
TERM alacritty
See related GitHub issue.
Window title
The default title is: Alacritty
. This can be changed via the shell.
Bash
In Bash, one can set the window title by manipulating the environment variable PROMPT_COMMAND.
The following will set the window title to: username@hostname:cwd
.
# set PROMPT_COMMAND
PROMPT_COMMAND=${PROMPT_COMMAND:+$PROMPT_COMMAND; }'printf "\033]0;%s@%s:%s\007" "${LOGNAME}" "${HOSTNAME%%.*}" "${PWD/#$HOME/\~}"'
Zsh
In Zsh, one can set the window title by using the functions precmd()
and preexec()
:
The following will set the window title to: username@hostname: zsh[shell_level] cwd_or_current_command
For example, when user larry
is in the /etc/conf.d
directory, this will be the title bar:
larry@gentoo.local: zsh[4] /etc/conf.d
While executing tail -f /var/log/*
:
larry@gentoo.local: zsh[4] tail -f /var/log/*
if [[ "${TERM}" != "" && "${TERM}" == "alacritty" ]]
then
precmd()
{
# output on which level (%L) this shell is running on.
# append the current directory (%~), substitute home directories with a tilde.
# "\a" bell (man 1 echo)
# "print" must be used here; echo cannot handle prompt expansions (%L)
print -Pn "\e]0;$(id --user --name)@$(hostname): zsh[%L] %~\a"
}
preexec()
{
# output current executed command with parameters
echo -en "\e]0;$(id --user --name)@$(hostname): ${1}\a"
}
fi
See also
- Terminal emulator — emulates a video terminal within another display architecture (e.g. in X).
External resources
- Rust Meetup January 2017 - A short talk about Alacritty at the Rust Meetup January 2017 (starts at 57:00).
References
- ↑ https://github.com/kovidgoyal/kitty/issues/2701#issuecomment-636497270 https://lwn.net/Articles/751763/
- ↑ Joe Wilm, Announcing Alacritty, a GPU-accelerated terminal emulator, jwilm.io. Retrieved on December 6, 2018
- ↑ https://github.com/alacritty/alacritty/tree/v0.5.0#faq