windowManager: Handle return value/errors from systemd unit calls
These may produce errors, and return a value indicating we should proceed further. Check for those when starting/stopping gsd-xsettings. https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1238 https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/2755
This commit is contained in:
parent
5f945294c8
commit
894ca0dd07
@ -900,35 +900,45 @@ var WindowManager = class {
|
|||||||
|
|
||||||
global.display.connect('init-xserver', (display, task) => {
|
global.display.connect('init-xserver', (display, task) => {
|
||||||
IBusManager.getIBusManager().restartDaemon(['--xim']);
|
IBusManager.getIBusManager().restartDaemon(['--xim']);
|
||||||
Shell.util_start_systemd_unit('gsd-xsettings.target', 'fail');
|
|
||||||
|
|
||||||
/* Leave this watchdog timeout so don't block indefinitely here */
|
try {
|
||||||
let timeoutId = GLib.timeout_add_seconds(GLib.PRIORITY_DEFAULT, 5, () => {
|
if (Shell.util_start_systemd_unit('gsd-xsettings.target', 'fail')) {
|
||||||
Gio.DBus.session.unwatch_name(watchId);
|
/* Leave this watchdog timeout so don't block indefinitely here */
|
||||||
log('Warning: Failed to start gsd-xsettings');
|
let timeoutId = GLib.timeout_add_seconds(GLib.PRIORITY_DEFAULT, 5, () => {
|
||||||
task.return_boolean(true);
|
Gio.DBus.session.unwatch_name(watchId);
|
||||||
timeoutId = 0;
|
log('Warning: Failed to start gsd-xsettings');
|
||||||
return GLib.SOURCE_REMOVE;
|
|
||||||
});
|
|
||||||
|
|
||||||
/* When gsd-xsettings daemon is started, we are good to resume */
|
|
||||||
let watchId = Gio.DBus.session.watch_name(
|
|
||||||
'org.gnome.SettingsDaemon.XSettings',
|
|
||||||
Gio.BusNameWatcherFlags.NONE,
|
|
||||||
() => {
|
|
||||||
Gio.DBus.session.unwatch_name(watchId);
|
|
||||||
if (timeoutId > 0) {
|
|
||||||
task.return_boolean(true);
|
task.return_boolean(true);
|
||||||
GLib.source_remove(timeoutId);
|
timeoutId = 0;
|
||||||
}
|
return GLib.SOURCE_REMOVE;
|
||||||
},
|
});
|
||||||
null);
|
|
||||||
|
/* When gsd-xsettings daemon is started, we are good to resume */
|
||||||
|
let watchId = Gio.DBus.session.watch_name(
|
||||||
|
'org.gnome.SettingsDaemon.XSettings',
|
||||||
|
Gio.BusNameWatcherFlags.NONE,
|
||||||
|
() => {
|
||||||
|
Gio.DBus.session.unwatch_name(watchId);
|
||||||
|
if (timeoutId > 0) {
|
||||||
|
task.return_boolean(true);
|
||||||
|
GLib.source_remove(timeoutId);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
null);
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
log('Error starting gsd-xsettings: %s'.format(e.message));
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
global.display.connect('x11-display-closing', () => {
|
global.display.connect('x11-display-closing', () => {
|
||||||
if (!Meta.is_wayland_compositor())
|
if (!Meta.is_wayland_compositor())
|
||||||
return;
|
return;
|
||||||
Shell.util_stop_systemd_unit('gsd-xsettings.target', 'fail');
|
try {
|
||||||
|
Shell.util_stop_systemd_unit('gsd-xsettings.target', 'fail');
|
||||||
|
} catch (e) {
|
||||||
|
log('Error stopping gsd-xsettings: %s'.format(e.message));
|
||||||
|
}
|
||||||
IBusManager.getIBusManager().restartDaemon();
|
IBusManager.getIBusManager().restartDaemon();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user