[gnome-builder] foundry: set some basic environment vars when necessary
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] foundry: set some basic environment vars when necessary
- Date: Wed, 12 Feb 2020 17:55:36 +0000 (UTC)
commit b1023f54b378135fa75d93c6234371d6c1f2d408
Author: Christian Hergert <chergert redhat com>
Date: Wed Feb 12 09:55:15 2020 -0800
foundry: set some basic environment vars when necessary
These get set when we launch terminals, so we can set them as fallback for
applications too. Ideally it would have been handled all for us, but we
might need to be more explicit when running via external launcher systems.
src/libide/foundry/ide-run-manager.c | 27 +++++++++++++++++++++++++++
1 file changed, 27 insertions(+)
---
diff --git a/src/libide/foundry/ide-run-manager.c b/src/libide/foundry/ide-run-manager.c
index b4483aa13..c5de0c44d 100644
--- a/src/libide/foundry/ide-run-manager.c
+++ b/src/libide/foundry/ide-run-manager.c
@@ -422,6 +422,32 @@ ide_run_manager_run_cb (GObject *object,
IDE_EXIT;
}
+static void
+copy_builtin_envvars (IdeEnvironment *environment)
+{
+ static const gchar *copy_env[] = {
+ "COLORTERM",
+ "DESKTOP_SESSION",
+ "LANG",
+ "WAYLAND_DISPLAY",
+ "XDG_CURRENT_DESKTOP",
+ "XDG_SEAT",
+ "XDG_SESSION_DESKTOP",
+ "XDG_SESSION_ID",
+ "XDG_SESSION_TYPE",
+ "XDG_VTNR",
+ };
+
+ for (guint i = 0; i < G_N_ELEMENTS (copy_env); i++)
+ {
+ const gchar *key = copy_env[i];
+ const gchar *val = g_getenv (key);
+
+ if (val != NULL && ide_environment_getenv (environment, key) == NULL)
+ ide_environment_setenv (environment, key, val);
+ }
+}
+
static void
do_run_async (IdeRunManager *self,
IdeTask *task)
@@ -491,6 +517,7 @@ do_run_async (IdeRunManager *self,
environment = ide_runner_get_environment (runner);
/* FIXME: Allow toggling this in build prefs */
ide_environment_setenv (environment, "G_MESSAGES_DEBUG", "all");
+ copy_builtin_envvars (environment);
ide_environment_copy_into (ide_config_get_environment (config), environment, TRUE);
g_signal_emit (self, signals [RUN], 0, runner);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]