Jun Aruga's Blog

Output, activities, memo and etc.

Setup and use Alacritty on Fedora

I am trying to use Sway window manager on Fedora, stopping the i3 window manager.

Here is a Sway installation guide on Fedora. And after installing the Sway, I see the terminal emulator Alacritty is used as the window manager's default terminal. Seeing the Youtube videos about Alacritty, it looks the terminal is one of the best and fastest terminals. So, I decided to practice before moving to Sway first.

On Fedora 35, the installation is simple.

Install

$ sudo dnf install alacritty

$ rpm -q alacritty
alacritty-0.9.0-1.fc35.x86_64

Edit config file

Checking the Alacritty's GitHub repository. The config file is alacritty.yml.

I see the config file is on the following path.

$ rpm -ql alacritty | grep yml
/usr/share/alacritty/alacritty.yml

Edit the config file.

$ mkdir .config/alacritty
$ cp -p /usr/share/alacritty/alacritty.yml .config/alacritty/
$ vi .config/alacritty/alacritty.yml

I referred mainly ArchWiki Alacritty. The terminal has interesting features: VI mode: to copy & past from keyboards without mouse.

On the copy and paste on the terminal, I did set like this.

  - { key: V, mods: Alt, action: Paste }
  - { key: C, mods: Alt, action: Copy }

I saw the "Shift+Key6"(="^") and "Shift+Key4"(="$") don't work on the VI mode. However the issue ticket Keybinding doesn't work (Shift + Key4) helped me.

Here is the key log by pressing "Left Shift+Key6". The left shift's key code is "42", and the "6"' key's key code is "7".

$ alacritty --print-events | grep "WindowEvent.*KeyboardInput"
code: 42, state: Pressed, virtual_keycode: Some(LShift), modifiers: SHIFT }, is_synthetic: false } }
[2021-12-25 22:05:09.011835103] [INFO ] [alacritty] glutin event: WindowEvent { window_id: WindowId(X(WindowId(27262980))), event: KeyboardInput { device_id: DeviceId(X(DeviceId(3))), input: KeyboardInput { scancode: 7, state: Pressed, virtual_keycode: None, modifiers: SHIFT }, is_synthetic: false } }
[2021-12-25 22:05:09.138091554] [INFO ] [alacritty] glutin event: WindowEvent { window_id: WindowId(X(WindowId(27262980))), event: KeyboardInput { device_id: DeviceId(X(DeviceId(3))), input: KeyboardInput { scancode: 7, state: Released, virtual_keycode: None, modifiers: SHIFT }, is_synthetic: false } }
[2021-12-25 22:05:09.333081717] [INFO ] [alacritty] glutin event: WindowEvent { window_id: WindowId(X(WindowId(27262980))), event: KeyboardInput { device_id: DeviceId(X(DeviceId(3))), input: KeyboardInput { scancode: 42, state: Released, virtual_keycode: Some(LShift), modifiers: (empty) }, is_synthetic: false } }

Here is the key log by pressing "Right Shift+Key4". The right shift's key code is 54, and the "4"'s key's key code is "5".

$ alacritty --print-events | grep "WindowEvent.*KeyboardInput"
[2021-12-25 22:01:40.716750961] [INFO ] [alacritty] glutin event: WindowEvent { window_id: WindowId(X(WindowId(37748740))), event: KeyboardInput { device_id: DeviceId(X(DeviceId(3))), input: KeyboardInput { scancode: 54, state: Pressed, virtual_keycode: Some(RShift), modifiers: SHIFT }, is_synthetic: false } }
[2021-12-25 22:01:41.435884335] [INFO ] [alacritty] glutin event: WindowEvent { window_id: WindowId(X(WindowId(37748740))), event: KeyboardInput { device_id: DeviceId(X(DeviceId(3))), input: KeyboardInput { scancode: 5, state: Pressed, virtual_keycode: None, modifiers: SHIFT }, is_synthetic: false } }
[2021-12-25 22:01:41.569941439] [INFO ] [alacritty] glutin event: WindowEvent { window_id: WindowId(X(WindowId(37748740))), event: KeyboardInput { device_id: DeviceId(X(DeviceId(3))), input: KeyboardInput { scancode: 5, state: Released, virtual_keycode: None, modifiers: SHIFT }, is_synthetic: false } }
[2021-12-25 22:01:41.693722274] [INFO ] [alacritty] glutin event: WindowEvent { window_id: WindowId(X(WindowId(37748740))), event: KeyboardInput { device_id: DeviceId(X(DeviceId(3))), input: KeyboardInput { scancode: 54, state: Released, virtual_keycode: Some(RShift), modifiers: (empty) }, is_synthetic: false } }

So, the setting is like this my environment. (ThinkPad X1 Carbon).

  - { key: 7, mods: Shift, mode: Vi|~Search, action: First }
  - { key: 5, mods: Shift, mode: Vi|~Search, action: Last }

Measure the performance

Opening both alacritty and terminator on the left and right side on i3 window manager, then run time tree ~ one by one. I referred this youtube video Switching To The Alacritty Terminal Emulator - DistroTube.

On the terminal alacritty, here is the result.

$ time tree ~
...
real  0m7.001s
user  0m3.662s
sys 0m3.263s

On the terminal terminator, here is the result.

$ time tree ~
...
real  0m8.981s
user  0m3.528s
sys 0m3.219s

The alacritty is a little bit faster than terminator.