From d61464b48f6c134aaa2b4b524ecaeab4d68f0680 Mon Sep 17 00:00:00 2001 From: ljdi <33706763+ljdi@users.noreply.github.com> Date: Sun, 19 Apr 2026 21:34:57 +0800 Subject: [PATCH] Use meson config_path as fallback instead of hardcoded /usr/local The hardcoded fallback path /usr/local/etc/xdg/swaync/ breaks installs with custom prefixes (e.g. ~/.local). Use the meson build-time config_path to dynamically set the correct fallback. Fixes: #726 --- src/constants.vala.in | 1 + src/functions.vala | 6 ++++-- src/meson.build | 1 + 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/constants.vala.in b/src/constants.vala.in index 31779bc1..4f354f64 100644 --- a/src/constants.vala.in +++ b/src/constants.vala.in @@ -1,5 +1,6 @@ public class Constants { public const string VERSION = @VERSION@; public const string VERSIONNUM = @VERSION_NUM@; + public const string CONFIGPATH = @CONFIG_PATH@; public const uint ANIMATION_DURATION = 400; } diff --git a/src/functions.vala b/src/functions.vala index ec554534..3a9c9aba 100644 --- a/src/functions.vala +++ b/src/functions.vala @@ -145,7 +145,8 @@ namespace SwayNotificationCenter { path, "swaync/style.css"); } // Fallback location. Specified in postinstall.py. Mostly for Debian - paths += "/usr/local/etc/xdg/swaync/style.css"; + paths += Path.build_path (Path.DIR_SEPARATOR.to_string (), + Constants.CONFIGPATH, "style.css"); info ("Looking for CSS file in these directories:\n\t- %s", string.joinv ("\n\t- ", paths)); @@ -187,7 +188,8 @@ namespace SwayNotificationCenter { path, "swaync/config.json"); } // Fallback location. Specified in postinstall.py. Mostly for Debian - paths += "/usr/local/etc/xdg/swaync/config.json"; + paths += Path.build_path (Path.DIR_SEPARATOR.to_string (), + Constants.CONFIGPATH, "config.json"); info ("Looking for config file in these directories:\n\t- %s", string.joinv ("\n\t- ", paths)); diff --git a/src/meson.build b/src/meson.build index 7b9700f5..17c53e11 100644 --- a/src/meson.build +++ b/src/meson.build @@ -16,6 +16,7 @@ version = 'swaync @0@'.format(version) const_config_data = configuration_data() const_config_data.set_quoted('VERSION', version) const_config_data.set_quoted('VERSION_NUM', meson.project_version()) +const_config_data.set_quoted('CONFIG_PATH', join_paths(get_option('prefix'), config_path)) constants = configure_file( input : 'constants.vala.in', output : 'constants.vala',