config_libconfig: search additional directories for included file

Bump the minimal required version of libconfig to 1.7. Time to force
debian to update their 10 years old version of libconfig.

Fixes #931

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
This commit is contained in:
Yuxuan Shui 2024-05-19 22:29:47 +01:00
parent 50e092cbc0
commit b6abeb00ff
No known key found for this signature in database
GPG Key ID: D3A4405BE6CC17F4
4 changed files with 21 additions and 2 deletions

View File

@ -2,6 +2,7 @@
## New features
* `@include` directives in config file now also search in `$XDG_CONFIG_HOME/picom/include` and `$XDG_CONFIG_DIRS/picom/include`, in addition to relative to the config file's parent directory.
* Allow `corner-radius-rules` to override `corner-radius = 0`. Previously setting corner radius to 0 globally disables rounded corners. (#1170)
* New `picom-inspect` tool, which lets you test out your picom rules. Sample output:
@ -49,7 +50,7 @@
* picom now uses some OpenGL 4.3 features.
* picom now optionally depends on `rtkit` at runtime to give itself realtime scheduling priority.
* `libconfig` is now a mandatory dependency.
* `libconfig` is now a mandatory dependency, with a minimal supported version of 1.7.
# v11.2 (2024-Feb-13)

View File

@ -421,6 +421,8 @@ CONFIGURATION FILES
-------------------
picom could read from a configuration file if libconfig support is compiled in. If *--config* is not used, picom will seek for a configuration file in `$XDG_CONFIG_HOME/picom.conf` (`~/.config/picom.conf`, usually), then `$XDG_CONFIG_HOME/picom/picom.conf`, then `$XDG_CONFIG_DIRS/picom.conf` (often `/etc/xdg/picom.conf`), then `$XDG_CONFIG_DIRS/picom/picom.conf`.
When `@include` directive is used in the config file, picom will first search for the included file in the parent directory of `picom.conf`, then in `$XDG_CONFIG_HOME/picom/include/`, then in `$XDG_CONFIG_DIRS/picom/include`.
picom uses general libconfig configuration file format. A sample configuration file is available as `picom.sample.conf` in the source tree. Most of commandline switches can be used as options in configuration file as well. For example, *--vsync* option documented above can be set in the configuration file using `vsync = `. Command line options will always overwrite the settings in the configuration file.
Window-type-specific settings are exposed only in configuration file and has the following format:

View File

@ -526,6 +526,21 @@ void generate_fading_config(struct options *opt) {
}
}
static const char **resolve_include(config_t * /* cfg */, const char *include_dir,
const char *path, const char **err) {
char *result = locate_auxiliary_file("include", path, include_dir);
if (result == NULL) {
*err = "Failed to locate included file";
return NULL;
}
log_debug("Resolved include file \"%s\" to \"%s\"", path, result);
const char **ret = ccalloc(2, const char *);
ret[0] = result;
ret[1] = NULL;
return ret;
}
/**
* Parse a configuration file from default location.
*
@ -568,6 +583,7 @@ char *parse_config_libconfig(options_t *opt, const char *config_file) {
if (parent) {
config_set_include_dir(&cfg, parent);
}
config_set_include_func(&cfg, resolve_include);
free(abspath);
}

View File

@ -34,7 +34,7 @@ endforeach
foreach i : required_xcb_packages
base_deps += [dependency(i, version: '>=1.12.0', required: true)]
endforeach
base_deps += [dependency('libconfig', version: '>=1.4', required: true)]
base_deps += [dependency('libconfig', version: '>=1.7', required: true)]
if not cc.has_header('uthash.h')
error('Dependency uthash not found')