Implement include command

The include command (`include <path>`) makes it possible to include sub
config files from the main config file (or from within other sub config
files).

The include command uses the following rules for including config files:

* the `path` can be either a full path or a path that is relative to the
  parent config. Shell expansion is supported, so it's possible to do
  `include ~/.config/sway.d/*`.
* The same config file can only be included once (to prevent include
  cycles). If a config is included multiple times it will just be
  ignored after it has been included once.
* Including a sub config file is the same as inserting the content of
  that file into the parent config, thus rules about overwriting
  bindsyms etc. works the same as for a single config.

Implement #542
This commit is contained in:
Mikkel Oscar Lyderik 2016-03-26 12:31:53 +01:00
parent 3da269b78a
commit 71a5350b68
4 changed files with 155 additions and 37 deletions

View file

@ -206,11 +206,11 @@ int main(int argc, char **argv) {
init_layout();
if (validate) {
bool valid = load_config(config_path);
bool valid = load_main_config(config_path, false);
return valid ? 0 : 1;
}
if (!load_config(config_path)) {
if (!load_main_config(config_path, false)) {
sway_terminate(EXIT_FAILURE);
}