[gnome-shell/wip/hadess/always-launch-discrete-gpu: 4/4] appDisplay: Respect X-KDE-RunOnDiscreteGpu appInfo property



commit ca2aa7395ef743c476522a1fb93b6f161753d936
Author: Bastien Nocera <hadess hadess net>
Date:   Mon Oct 21 12:55:38 2019 +0200

    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 integrated GPU otherwise.
    
    Closes: https://gitlab.gnome.org/GNOME/gnome-shell/issues/1804

 js/ui/appDisplay.js | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
---
diff --git a/js/ui/appDisplay.js b/js/ui/appDisplay.js
index d79c9b54b6..34aaa054aa 100644
--- a/js/ui/appDisplay.js
+++ b/js/ui/appDisplay.js
@@ -2513,12 +2513,15 @@ var AppIconMenu = class AppIconMenu extends PopupMenu.PopupMenu {
                 this._appendSeparator();
             }
 
+            let wantsDiscreteGpu = appInfo.get_boolean("X-KDE-RunOnDiscreteGpu");
             if (discreteGpuAvailable &&
                 this._source.app.state == Shell.AppState.STOPPED) {
-                this._onDiscreteGpuMenuItem = this._appendMenuItem(_("Launch using Dedicated Graphics 
Card"));
+                this._onDiscreteGpuMenuItem = this._appendMenuItem(wantsDiscreteGpu
+                    ? _("Launch using Integrated Graphics Card")
+                    : _("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, wantsDiscreteGpu ? 0 : 1);
                     this.emit('activate-window', null);
                 });
             }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]