shell-app: Add PrefersNonDefaultGPU support to shell_app_launch()
Read the "PrefersNonDefaultGPU" key in desktop files to figure out whether the application prefers running on the discrete GPU, or the default GPU, and apply that. Update the "Launch..." contextual menu to allow launching on the default GPU if the application "prefers [the] non default GPU". See: https://specifications.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html#recognized-keys https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/1804
This commit is contained in:

committed by
Florian Müllner

parent
13dcd78be1
commit
34da48453e
@ -2512,10 +2512,16 @@ var AppIconMenu = class AppIconMenu extends PopupMenu.PopupMenu {
|
||||
|
||||
if (discreteGpuAvailable &&
|
||||
this._source.app.state == Shell.AppState.STOPPED) {
|
||||
this._onDiscreteGpuMenuItem = this._appendMenuItem(_("Launch using Dedicated Graphics Card"));
|
||||
this._onDiscreteGpuMenuItem.connect('activate', () => {
|
||||
const appPrefersNonDefaultGPU = appInfo.get_boolean('PrefersNonDefaultGPU');
|
||||
const gpuPref = appPrefersNonDefaultGPU
|
||||
? Shell.AppLaunchGpu.DEFAULT
|
||||
: Shell.AppLaunchGpu.DISCRETE;
|
||||
this._onGpuMenuItem = this._appendMenuItem(appPrefersNonDefaultGPU
|
||||
? _('Launch using Integrated Graphics Card')
|
||||
: _('Launch using Discrete Graphics Card'));
|
||||
this._onGpuMenuItem.connect('activate', () => {
|
||||
this._source.animateLaunch();
|
||||
this._source.app.launch(0, -1, true);
|
||||
this._source.app.launch(0, -1, gpuPref);
|
||||
this.emit('activate-window', null);
|
||||
});
|
||||
}
|
||||
|
Reference in New Issue
Block a user