ibusManager: Add missing environment variables required to launch ibus-daemon

IBus requires XAUTHORITY and XDG_RUNTIME_DIR to be able to spawn its XIM
implementation correctly. Using launch context to get environment can correctly
launch on non-systemd setups.

Closes: #6998

Signed-off-by: xiaofan <xiaofan@iscas.ac.cn>
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2947>
This commit is contained in:
xiaofan 2023-09-10 09:56:33 +02:00 committed by Marge Bot
parent ee11ecac46
commit 050d0e10c7

View File

@ -115,17 +115,9 @@ class IBusManager extends Signals.EventEmitter {
_spawn(extraArgs = []) { _spawn(extraArgs = []) {
try { try {
let cmdLine = ['ibus-daemon', '--panel', 'disable', ...extraArgs]; const cmdLine = ['ibus-daemon', '--panel', 'disable', ...extraArgs];
let env = []; const launchContext = global.create_app_launch_context(0, -1);
const env = launchContext.get_environment();
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');
// Use DO_NOT_REAP_CHILD to avoid adouble-fork internally // Use DO_NOT_REAP_CHILD to avoid adouble-fork internally
// since ibus-daemon refuses to start with init as its parent. // since ibus-daemon refuses to start with init as its parent.
const [success_, pid] = GLib.spawn_async( const [success_, pid] = GLib.spawn_async(