Alacritty

From Gentoo Wiki
Jump to: navigation, search
Resources
Article status
This article has some todo items:
  • Add more info
  • Tips and tricks
This article is a stub. You can help by expanding it.

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 doesn't 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

X Add support for X11
debug Enable extra debug codepaths, like asserts and extra output. If you want to get meaningful backtraces see https://wiki.gentoo.org/wiki/Project:Quality_Assurance/Backtraces
wayland Enable dev-libs/wayland backend

Installation

Emerge

Install x11-terms/alacritty package:

root #emerge --ask x11-terms/alacritty

Configuration

Files

Alacritty doesn't create the config 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 default configuration file get installed into /usr/share/alacritty/scripts/ directory.

Important
The configuration file is YAML -formatted. Preserving the indentation is critical.

Alacritty configuration file takes effect automatically,it can be disabled by:

user $alacritty --no-live-config-reload

For better use, the config file should be downloaded and edited: alacritty.yml. For detailed explanation of the config file, please consult the comments in the default config file.

Font configuration

To make things easier users can run following command and just copy and paste the desired font name:

user $fc-list -f '%{family}\n' | awk '!x[$0]++'

Changing the default font by editing the config file.

FILE ~/.config/alacritty/alacritty.ymlfont 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

Note
This method uses defaults for all other settings.

Colors configuration

FILE ~/.config/alacritty/alacritty.ymlcolor schemes
schemes:
  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

FILE ~/.config/alacritty/alacritty.ymltransparent background configure
background_opacity: 0.8  # value range is 0 ~ 1

Troubleshooting

Using fcitx

This needs app-i18n/fcitx and x11-wm/i3 installed. The initialization file should look like this:

FILE ~/.xprofile or ~/.xinitrc.xinitrc
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.

Colorless

Alacritty didn't set $PS1 or $LS_COLORS, these can be set in the ~/.bashrc or /etc/profile or other rc file.

For example:

FILE ~/.bashrcbash 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:

FILE ~/.bashrcls color configure
# use alias
alias ls='ls --color=auto'

Window title

Default title is: "Alacritty", we will set it to "user@host:cwd".

FILE ~/.bashrcwindow title bar
# set PROMPT_COMMAND
PROMPT_COMMAND=${PROMPT_COMMAND:+$PROMPT_COMMAND; }'printf "\033]0;%s@%s:%s\007" "${USER}" "${HOSTNAME%%.*}" "${PWD/#$HOME/\~}"'
Note
This may not work with other shells than bash.

See also

  • Terminal emulator — emulates a video terminal within another display architecture (usually X).

External resources

References

  1. Joe Wilm, Announcing Alacritty, a GPU-accelerated terminal emulator, jwilm.io. Retrieved on December 6, 2018