[pulseaudio-discuss] [PATCH] client-conf: prefer client.conf over settings from X11

Tanu Kaskinen tanuk at iki.fi
Sun May 20 11:47:13 UTC 2018


The original thinking was probably that the X11 variables are kind of
similar to environment variables, so they should override the settings
in client.conf, but I don't think that's a good way to think about it.
Unlike environment variables, the X11 variables are practically never
set by the user, they (in particular the server address) are set by
module-x11-publish that is automatically loaded by the
start-pulseaudio-x11 script. As a result, it was confusing why setting
the default-server option in client.conf didn't have any effect, when
the PULSE_SERVER variable from X11 was overriding it.

Therefore, let's load the X11 variables before parsing client.conf, so
that client.conf will override them.
---
 src/pulse/client-conf.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/pulse/client-conf.c b/src/pulse/client-conf.c
index 1daaf9111..c5b67429a 100644
--- a/src/pulse/client-conf.c
+++ b/src/pulse/client-conf.c
@@ -149,6 +149,12 @@ void pa_client_conf_load(pa_client_conf *c, bool load_from_x11, bool load_from_e
         { NULL,                     NULL,                     NULL, NULL },
     };
 
+    if (load_from_x11) {
+#ifdef HAVE_X11
+        pa_client_conf_from_x11(c);
+#endif
+    }
+
     f = pa_open_config_file(DEFAULT_CLIENT_CONFIG_FILE, DEFAULT_CLIENT_CONFIG_FILE_USER, ENV_CLIENT_CONFIG_FILE, &fn);
     if (f) {
         pa_config_parse(fn, f, table, NULL, true, NULL);
@@ -156,12 +162,6 @@ void pa_client_conf_load(pa_client_conf *c, bool load_from_x11, bool load_from_e
         fclose(f);
     }
 
-    if (load_from_x11) {
-#ifdef HAVE_X11
-        pa_client_conf_from_x11(c);
-#endif
-    }
-
     if (load_from_env)
         load_env(c);
 }
-- 
2.17.0



More information about the pulseaudio-discuss mailing list