Source/import file from i3wm config

2.2k views Asked by At

I want to be able to change my colorsheme from a script. I have a file which I replace with the different color shemes (from this repo). Currently I have a "base" file with everything but the colors and I use bindsym $mod+Shift+c exec "cat ~/.config/i3/colors ~/.config/i3/base > ~/.config/i3/config && i3-msg reload" to build the "real" config from the two files. A much more elegant solution would be to source/import the "colors"-file in the config. Unfortunately I couldn't find anything related.

Is it possible to import variables in the i3 config from another file?

2

There are 2 answers

0
Florian Mayer On BEST ANSWER

Since i3 v4.20, it is possible to include other configuration files from your i3 configuration.

https://i3wm.org/docs/userguide.html#include

0
Talkerbox On

As I can see in original docs (https://i3wm.org/docs/userguide.html#variables):

If you need a more dynamic configuration you should create a little script which generates a configuration file and run it before starting i3 (for example in your ~/.xsession file).

It's part about variables and any dynamic config for i3. So, your method is valid and any more elegant way is no in i3 by default.