Alacritty
- Add more info
- Tips and tricks
Alacritty is a terminal emulator focused on simplicity and performance. The performance goal means it should 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 better provided by a window manager)[1].
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 create the configuration file, but it looks 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
The configuration file is YAML -formatted. Preserving the indentation is critical.
Alacritty reloads the configuration automatically, which can be disabled via CLI:
user $
alacritty --no-live-config-reload
This can also be disabled via the configuration file:
~/.config/alacritty/alacritty.yml
disable live reload# 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.
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.
~/.config/alacritty/alacritty.yml
font configure# 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 Hack
This method uses defaults for all other settings.
Colors configuration
~/.config/alacritty/alacritty.yml
color schemesschemes: solarized_light: &light primary: #... normal: #... bright: #... solarized_dark: &dark primary: #... normal: #... bright: #... colors: *light
With this config, Alacritty will use Solarized Light
. To switch to the dark version, change colors: *light
to colors: *dark
.
More schemes can be found from this page: alacritty Wiki of Color schemes.
Transparent background
~/.config/alacritty/alacritty.yml
transparent background configurebackground_opacity: 0.8 # value range is 0 ~ 1
Configuration with tabbed
Since Alacritty does not support tabs intentionally[2], one can use x11-misc/tabbed:
user $
tabbed -r 2 alacritty --embed ""
See also:
user $
man 1 tabbed
user $
man 1 alacritty
Troubleshooting
Using fcitx
This needs app-i18n/fcitx and x11-wm/i3 installed. The initialization file should look like this:
~/.xprofile or ~/.xinitrc
.xinitrcexport 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.
Colorless
Alacritty did not set $PS1
or $LS_COLORS
, these can be set in the ~/.bashrc
or /etc/profile
or other rc
file.
For example:
~/.bashrc
bash color configure# prompt export PS1="\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ "
There is a simple way to set colorful file:
~/.bashrc
ls color configure# use alias alias ls='ls --color=auto'
Window title
The default title is: Alacritty
.
Bash
In Bash, one can set the window title by manipulating the environment variable PROMT_COMMAND
.
The following will set the window title to: username@hostname:cwd
.
~/.bashrc
window title bar# set PROMPT_COMMAND PROMPT_COMMAND=${PROMPT_COMMAND:+$PROMPT_COMMAND; }'printf "\033]0;%s@%s:%s\007" "${USER}" "${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:
larry@gentoo.local: zsh[4] /etc/conf.d
While executing tail -f /var/log/*
:
larry@gentoo.local: zsh[4] tail -f /var/log/*
~/.zshrc
window title barif [[ "${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 (usually X).
External resources
- Rust Meetup January 2017 - A short talk about Alacritty at the Rust Meetup January 2017 (starts at 57:00).
References
- ↑ 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