Local config for kitty

Posted on June 1, 2022

As I mentioned in the last post, I am testing out kitty as my terminal emulator instead of UXTerm. So for everything has been smooth sailing except for one minor issue. On my work desktop, I want fontsize 11 but on my laptop, I want fontsize 14. This is a combination of resolution and physical size of the two monitors. Reading the documentation of kitty.conf, it was not clear how to set conditional values for the variables.

On a whim, I tried to see if kitty.conf can read environmental variables and it can! So I created two config files, desktop-hostname.conf and laptop-hostname.conf, where the names correspond to the value of $HOST on the two systems. Then, I end my kitty.conf with

include ./${HOSTNAME}.conf

I can now add the settings for my desktop in the desktop-hostname.conf file and the settings for my laptop on laptop-hostname.conf file.

Note that for this to work, HOSTNAME should be a system wide environmental variable. What that means is that it should be set in /etc/environment. Setting the variables in $HOME/.profile would not work, as that file is sourced after kitty is launched.


This entry was posted in CLI and tagged kitty, configuration.