aboutsummaryrefslogtreecommitdiff
path: root/parser-specs
diff options
context:
space:
mode:
authorMichael Stapelberg <stapelberg@users.noreply.github.com>2021-06-02 21:01:43 +0200
committerGitHub <noreply@github.com>2021-06-02 21:01:43 +0200
commiteaa5e636f96815ddf7f236d35aa9b8686388aa76 (patch)
treeeec740574101a42b4733c6c53483338efb130a0f /parser-specs
parent4c93f61353ffa905a4f15cb98524280cd92c53cb (diff)
downloadi3-eaa5e636f96815ddf7f236d35aa9b8686388aa76.tar.gz
i3-eaa5e636f96815ddf7f236d35aa9b8686388aa76.zip
Implement include config directive (#4420)
The implementation uses wordexp(3) just like sway: https://github.com/i3/i3/issues/1197#issuecomment-226844106 Thanks to jajm for their implementation at https://github.com/jajm/i3/commit/bb55709d0aa0731f7b3c641871731a992ababb1a This required refactoring the config parser to be re-entrant (no more global state) and to return an error instead of dying. In case a file cannot be opened, i3 reports an error but proceeds with the remaining configuration. Key bindings can be overwritten or removed using the new --remove flag of the bindsym/bindcode directive. All files that were successfully included are displayed in i3 --moreversion. One caveat is i3 config file variable expansion, see the note in the userguide. fixes #4192
Diffstat (limited to 'parser-specs')
-rw-r--r--parser-specs/config.spec8
1 files changed, 8 insertions, 0 deletions
diff --git a/parser-specs/config.spec b/parser-specs/config.spec
index 7d7b9989..1b6d7340 100644
--- a/parser-specs/config.spec
+++ b/parser-specs/config.spec
@@ -20,6 +20,7 @@ state INITIAL:
'set ' -> IGNORE_LINE
'set ' -> IGNORE_LINE
'set_from_resource' -> IGNORE_LINE
+ 'include' -> INCLUDE
bindtype = 'bindsym', 'bindcode', 'bind' -> BINDING
'bar' -> BARBRACE
'font' -> FONT
@@ -63,6 +64,11 @@ state IGNORE_LINE:
line
-> INITIAL
+# include <pattern>
+state INCLUDE:
+ pattern = string
+ -> call cfg_include($pattern)
+
# floating_minimum_size <width> x <height>
state FLOATING_MINIMUM_SIZE_WIDTH:
width = number
@@ -394,6 +400,8 @@ state BINDCOMMAND:
->
command = string
-> call cfg_binding($bindtype, $modifiers, $key, $release, $border, $whole_window, $exclude_titlebar, $command)
+ end
+ -> call cfg_binding($bindtype, $modifiers, $key, $release, $border, $whole_window, $exclude_titlebar, $command)
################################################################################
# Mode configuration