3

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?

Michael
  • 657
  • 5
  • 22

2 Answers2

5

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

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

Florian Mayer
  • 3,041
  • 24
  • 17
1

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.

Talkerbox
  • 385
  • 1
  • 4
  • 15