labwc/include/common
Johan Malm 698c7ace07 config: support merging multiple config files
Add the -m|--merge-config command line option to iterate backwards over
XDG Base Dir paths and read config/theme files multiple times.

For example if both ~/.config/labwc/rc.xml and /etc/xdg/labwc/rc.xml
exist, the latter will be read first and then the former (if
--merge-config is enabled).

When $XDG_CONFIG_HOME is defined, make it replace (not augment)
$HOME/.config. Similarly, make $XDG_CONFIG_DIRS replace /etc/xdg when
defined.

XDG Base Dir Spec does not specify whether or not an application (or a
compositor!) should (a) define that only the file under the most important
base directory should be used, or (b) define rules for merging the
information from the different files.

ref: https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html

In the case of labwc there is a use-case for both positions, just to be
clear, the default behaviour, described by position (a) above, does NOT
change.

This change affects the following config/theme files:
  - rc.xml
  - menu.xml
  - autostart
  - environment
  - themerc
  - themerc-override
  - Theme buttons, for example max.xbm

Instead of caching global config/theme directories, create lists of paths
(e.g.  '/home/foo/.config/labwc/rc.xml', '/etc/xdg/labwc/rc.xml', etc).
This creates more common parsing logic and just reversing the direction
of iteration and breaks early if config-merge is not wanted.

Enable better fallback for themes. For example if a particular theme does
not exist in $HOME/.local/share/themes, it will be searched for in
~/.themes/ and so on. This also applies to theme buttons which now
fallback on an individual basis.

Avoid using stat() in most situations and just go straight to fopen().

Fixes #1406
2024-01-18 20:20:36 +00:00
..
array.h common/array.h: add wl_array_for_each_reverse macro 2023-11-21 22:31:05 +01:00
border.h Move border-struct to common/border.h for sharing 2023-06-26 06:04:07 +01:00
buf.h action: do not expand env vars in Exec action 2023-09-23 14:52:59 +01:00
dir.h config: support merging multiple config files 2024-01-18 20:20:36 +00:00
fd_util.h includes: identifier consistency in include guards 2023-05-13 22:29:21 +01:00
file-helpers.h common/file-helpers.c: share file_exists() to reduce duplication 2023-09-17 19:26:41 +01:00
font.h includes: identifier consistency in include guards 2023-05-13 22:29:21 +01:00
grab-file.h includes: identifier consistency in include guards 2023-05-13 22:29:21 +01:00
graphic-helpers.h theme: create hover button fallbacks 2023-12-21 02:42:23 +01:00
list.h includes: identifier consistency in include guards 2023-05-13 22:29:21 +01:00
macros.h common: move MIN and MAX to common/macros.h 2023-10-21 12:37:42 +01:00
match.h common: use fnmatch() for pattern matching 2023-10-01 14:17:29 +01:00
mem.h includes: identifier consistency in include guards 2023-05-13 22:29:21 +01:00
nodename.h includes: identifier consistency in include guards 2023-05-13 22:29:21 +01:00
parse-bool.h includes: identifier consistency in include guards 2023-05-13 22:29:21 +01:00
scaled_font_buffer.h scaled_scene_buffer: make dropping the buffer optional 2023-10-19 21:48:57 +01:00
scaled_scene_buffer.h scaled_scene_buffer: make dropping the buffer optional 2023-10-19 21:48:57 +01:00
scene-helpers.h chase: use wlroots tree node getters 2023-12-03 18:24:26 +00:00
spawn.h includes: identifier consistency in include guards 2023-05-13 22:29:21 +01:00
string-helpers.h theme: create hover button fallbacks 2023-12-21 02:42:23 +01:00