-
generate an i3 config from a set of
.conf
files in<i3 config folder>/config.d
. -
automatically restart or reload i3 when changes were made (optional - on by default). This makes it possible to dynamically change settings that need changes in the configuration files (e.g. switch bar mode between hide and docked or cycle through different color schemes).
-
keep it DRY (optional):
- assign variables to variables
- use variables in i3status configuration files
- generate
bar {...}
settings from a simple template with some extra config.
- build main config and one or several i3status configs from the same sources
- variables are handled slightly more intelligently than i3 does it (variables assigned to other variables are resolved)
- end of line comments are possible (removed at build time)
- variables in i3status configs are also resolved (set anywhere in the sources)
- reload or restart i3 when a change has been done (using
i3-msg
) - notify when new config has been created and activated (using
notify-send
) - simple way to render partials based on key value pairs in file name
- simple way to change the configuration by sending messages
- build config as one shot script or watch for changes
- send messages to watching i3configger process
- (WARNING - this does not work reliably yet) if
i3 -C fails
with the newly rendered config, the old config will be kept, no harm done
Note the code is Python 3.6 only. I want to play with the new toys :)
i3configger
is released on the Python Package Index. The standard installation method is:
$ pip install i3configger
i3configger release announcements and discussion
- Cut your config file into chewable chunks with the extension
.conf
and put them in the directory<i3 config folder>/config.d
. - Run
i3configger
. i3configger.json
and.state.json
are created inconfig.d
- A new config file is generated instead of your old config.
- A backup of the last config is kept with suffix
.bak
i3configger.json
can be used to do configuration of the status bars..state.json
remembers the state of your current settings
If you are experimenting with the config and want it automatically updated on change:
run it in the foreground:
$ i3configger --watch
run it as a daemon:
$ i3configger --daemon
stop the daemon:
$ i3configger --kill
I use this to generate my own i3 config. Here are the config partials and settings: .i3/config.d, from which config and all i3status.*conf
files are built.
With my config, the call:
$ i3configger select scheme solarized-dark
will integrate scheme.solarized-dark.conf
in the build and exclude all other scheme.*.conf
files.
$ i3configger select-next scheme
will switch to the next scheme (and wrap around to the first scheme)
This is persisted in .state.json
If I want to get my bar out of the way:
$ i3configger set mode hide
select
integrates different partial files. Config partials that follow the naming scheme <key>.<value>.conf
are only rendered into the config if explicitly set via configuration or a message from the command line.
set
assigns values to arbitrary variables that are set anywhere in the configuration.
All changes done this way are persisted in .state.json
.
- merge all files that fit the conditions and configuration
- read in all lines that fit the pattern
set $.*
- parse them into a map key -> value
- Resolve all indirect assignments (e.g.
set $bla $blub
) - Replace all variables in configs with their values (bar configs get local context merged before substitution)
- Write results
- Check if config is valid - if not switch back to saved backup
... from the i3wm ecosystem