GET_CONFIG: add raw/variable-processed contents of all config files (#4528)

We do this by adding to included_files as i3 processes the configs.

This should allow for easy debugging, without having to change how i3 processes
config files.

related to #4192
This commit is contained in:
Michael Stapelberg
2021-09-22 08:54:37 +02:00
committed by GitHub
parent d3ff9afbb5
commit 535da94536
11 changed files with 128 additions and 39 deletions

View File

@ -793,12 +793,44 @@ No payload.
*Reply:*
The config reply is a map which currently only contains the "config" member,
which is a string containing the config file as loaded by i3 most recently.
The config reply is a map which contains the following fields:
config (string)::
The top-level config file contents that i3 has loaded most recently.
This field is kept for backwards compatibility. See +included_configs+
instead.
included_configs (array of maps)::
i3 adds one entry to this array for each config file it loads, in
order. The first entrys +raw_contents+ are identical to the +config+
field.
Each +included_configs+ entry contains the following fields
path (string)::
Absolute path name to the config file that i3 loaded.
raw_contents (string)::
The raw contents of the file as i3 read them.
variable_replaced_contents (string)::
The contents of the file after i3 replaced all variables. This is useful
for debugging variable replacement.
*Example:*
-------------------
{ "config": "font pango:monospace 8\nbindsym Mod4+q exit\n" }
{
"config": "include font.cfg\n",
"included_configs": [
{
"path": "/home/michael/configfiles/i3/config",
"raw_contents": "include font.cfg\n",
"variable_replaced_contents": "include font.cfg\n"
},
{
"path": "/home/michael/configfiles/i3/font.cfg",
"raw_contents": "set $font pango:monospace 8\nfont $font",
"variable_replaced_contents": "set pango:monospace 8 pango:monospace 8\nfont pango:monospace 8\n"
}
],
}
-------------------
[[_tick_reply]]