appDisplay: Respect X-KDE-RunOnDiscreteGpu appInfo property

When X-KDE-RunOnDiscreteGpu is set in the application's .desktop file,
launch the application on the discrete GPU if available, and offer
to launch on the discrete GPU manually otherwise.

Closes: https://gitlab.gnome.org/GNOME/gnome-shell/issues/1804
This commit is contained in:
Bastien Nocera 2019-10-21 12:55:38 +02:00
parent 4d47b16d33
commit 366b06716d

View File

@ -2513,12 +2513,15 @@ var AppIconMenu = class AppIconMenu extends PopupMenu.PopupMenu {
this._appendSeparator();
}
let wantsDiscreteGpu = appInfo.get_boolean("PreferRunOnDiscreteGPU") ||
appInfo.get_boolean("X-KDE-RunOnDiscreteGpu");
if (discreteGpuAvailable &&
!wantsDiscreteGpu &&
this._source.app.state == Shell.AppState.STOPPED) {
this._onDiscreteGpuMenuItem = this._appendMenuItem(_("Launch using Dedicated Graphics Card"));
this._onDiscreteGpuMenuItem.connect('activate', () => {
this._source.animateLaunch();
this._source.app.launch(0, -1, true);
this._source.app.launch(0, -1, Shell.AppGpuSelection.DISCRETE);
this.emit('activate-window', null);
});
}