Alacritty (Part 2)
In my blog entry on GNOME Terminal this morning, I wrote that Alacritty cannot use different configuration for different terminals because configuration changes immediately apply to all terminals. Not long after writing that, I had an idea/realization that I may be able to specify a configuration file to use on the command line. Also, a friend emailed to let me know about a configuration option that I had missed.
Per Terminal Configuration
The alacritty
command does indeed have a
--config-file
option. You can keep your usual configuration
in alacritty.yml
so that it is used by default, and you can
put special configuration in other files. For example, I now have a
alacritty-present.yml
configuration file that configures
the terminal for presentations using a projector. I use the following
command to open a terminal using this configuration file.
alacritty --config-file ~/.config/alacritty/alacritty-present.yml
You can of course put this command into a script or configure a
hotkey to run it. Note that spawning a new instance using the
SpawnNewInstance
action spawns a new instance using the
same configuration (not the default). Great!
Alacritty configuration has import functionality, which you can use
to avoid duplicating common configuration. In my case, I put my full
configuration in alacritty.yml
. My
alacritty-present.yml
configuration file imports
alacritty.yml
and then specifies the settings that are
different, overriding my default settings. I really like the design.
This functionality gives me most of what I like about GNOME Terminal profiles. The only thing missing is the ability to change the configuration of a terminal that is already open, with existing content. For this reason, I still wish for an action to change the color scheme.
Live Configuration Reloading
Thank you very much to Chris Horn
for pointing out the live_config_reload
option! Setting
this option to false
turns off the automatic application of
configuration changes.
# Live config reload (changes require restart)
#live_config_reload: true
Since I now have a good way to run terminals with different
configuration, I will keep this setting set to true
. I
really like the immediate feedback provided by live reloading. Thanks to
this feature, Alacritty is easier to configure than any other terminal
emulator that I have tried!