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
bb55709d0a
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
This commit is contained in:
committed by
GitHub
parent
4c93f61353
commit
eaa5e636f9
@ -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
|
||||
|
Reference in New Issue
Block a user