Host-Specific i3 Config Variables

i3 doesn't let you define conditionals for per-host settings. So say you want to make your font larger only on your machine that has a 4k display (using 1 .i3/config) that becomes difficult.. However, as you may or may not know, you can define per-host conditionals in your .Xresources file using an #ifdef. Further, as it turns out; i3 now supports reading Xresources properties. As such, sharing an i3 config between hosts applying slightly different variables on each host for specific items is now trivial.

And that's it. By default on normal hosts, your font will be size 10; and on your somehostname host, your font size will be 20 in both urxvt and i3. Rinse and repeat for other variables you might want to change.12

i3 reads the Xresources properties currently applied; so xrdb ~/.Xresources after making changes to .Xresources