ibusManager: Pass on envrionment variables to ibus-daemon

Previously only DISPLAY was being passed on to ibus, which results in issues
with missing the WAYLAND_DISPLAY or the DBUS_SESSION_BUS_ADDRESS environemnt
variables for example.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2345>
This commit is contained in:
oreo639 2022-06-26 17:56:48 -07:00 committed by Florian Müllner
parent 4097f9f836
commit be52477610

View File

@ -90,11 +90,25 @@ var IBusManager = class {
this._spawn(Meta.is_wayland_compositor() ? [] : ['--xim']);
}
_tryAppendEnv(env, varname) {
const value = GLib.getenv(varname);
if (value)
env.push(`${varname}=${value}`);
}
_spawn(extraArgs = []) {
try {
let cmdLine = ['ibus-daemon', '--panel', 'disable', ...extraArgs];
let env = [];
this._tryAppendEnv(env, 'DBUS_SESSION_BUS_ADDRESS');
this._tryAppendEnv(env, 'WAYLAND_DISPLAY');
this._tryAppendEnv(env, 'HOME');
this._tryAppendEnv(env, 'LANG');
this._tryAppendEnv(env, 'LC_CTYPE');
this._tryAppendEnv(env, 'COMPOSE_FILE');
this._tryAppendEnv(env, 'DISPLAY');
GLib.spawn_async(
null, cmdLine, env,
GLib.SpawnFlags.SEARCH_PATH,