shell-app: Add "discrete_gpu" option when launching apps
And adapt existing callers to the new API. This will allow us to implement a way to launch applications on the discrete GPU for systems where an "Optimus" system exists. https://bugzilla.gnome.org/show_bug.cgi?id=773117
This commit is contained in:
parent
56d0d7253b
commit
39a840e2c3
@ -94,7 +94,7 @@ function spawnApp(argv) {
|
|||||||
Gio.AppInfoCreateFlags.SUPPORTS_STARTUP_NOTIFICATION);
|
Gio.AppInfoCreateFlags.SUPPORTS_STARTUP_NOTIFICATION);
|
||||||
|
|
||||||
let context = global.create_app_launch_context(0, -1);
|
let context = global.create_app_launch_context(0, -1);
|
||||||
app.launch([], context);
|
app.launch([], context, false);
|
||||||
} catch(err) {
|
} catch(err) {
|
||||||
_handleSpawnError(argv[0], err);
|
_handleSpawnError(argv[0], err);
|
||||||
}
|
}
|
||||||
|
@ -902,7 +902,7 @@ const EventsSection = new Lang.Class({
|
|||||||
let app = this._getCalendarApp();
|
let app = this._getCalendarApp();
|
||||||
if (app.get_id() == 'evolution.desktop')
|
if (app.get_id() == 'evolution.desktop')
|
||||||
app = Gio.DesktopAppInfo.new('evolution-calendar.desktop');
|
app = Gio.DesktopAppInfo.new('evolution-calendar.desktop');
|
||||||
app.launch([], global.create_app_launch_context(0, -1));
|
app.launch([], global.create_app_launch_context(0, -1), false);
|
||||||
},
|
},
|
||||||
|
|
||||||
setDate: function(date) {
|
setDate: function(date) {
|
||||||
|
@ -64,7 +64,8 @@ function startAppForMount(app, mount) {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
retval = app.launch(files,
|
retval = app.launch(files,
|
||||||
global.create_app_launch_context(0, -1))
|
global.create_app_launch_context(0, -1),
|
||||||
|
false)
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
log('Unable to launch the application ' + app.get_name()
|
log('Unable to launch the application ' + app.get_name()
|
||||||
+ ': ' + e.toString());
|
+ ': ' + e.toString());
|
||||||
|
@ -297,7 +297,7 @@ const RemoteSearchProvider = new Lang.Class({
|
|||||||
// the provider is not compatible with the new version of the interface, launch
|
// the provider is not compatible with the new version of the interface, launch
|
||||||
// the app itself but warn so we can catch the error in logs
|
// the app itself but warn so we can catch the error in logs
|
||||||
log('Search provider ' + this.appInfo.get_id() + ' does not implement LaunchSearch');
|
log('Search provider ' + this.appInfo.get_id() + ' does not implement LaunchSearch');
|
||||||
this.appInfo.launch([], global.create_app_launch_context(0, -1));
|
this.appInfo.launch([], global.create_app_launch_context(0, -1), false);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -1501,7 +1501,7 @@ const NMVPNSection = new Lang.Class({
|
|||||||
if (nItems > 1) {
|
if (nItems > 1) {
|
||||||
let appSys = Shell.AppSystem.get_default();
|
let appSys = Shell.AppSystem.get_default();
|
||||||
let app = appSys.lookup_app('gnome-network-panel.desktop');
|
let app = appSys.lookup_app('gnome-network-panel.desktop');
|
||||||
app.launch(0, -1);
|
app.launch(0, -1, false);
|
||||||
} else {
|
} else {
|
||||||
let connection = this._connections[0];
|
let connection = this._connections[0];
|
||||||
Util.spawnApp(['gnome-control-center', 'network', 'show-device',
|
Util.spawnApp(['gnome-control-center', 'network', 'show-device',
|
||||||
|
@ -505,7 +505,7 @@ shell_app_activate_full (ShellApp *app,
|
|||||||
case SHELL_APP_STATE_STOPPED:
|
case SHELL_APP_STATE_STOPPED:
|
||||||
{
|
{
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
if (!shell_app_launch (app, timestamp, workspace, &error))
|
if (!shell_app_launch (app, timestamp, workspace, FALSE, &error))
|
||||||
{
|
{
|
||||||
char *msg;
|
char *msg;
|
||||||
msg = g_strdup_printf (_("Failed to launch “%s”"), shell_app_get_name (app));
|
msg = g_strdup_printf (_("Failed to launch “%s”"), shell_app_get_name (app));
|
||||||
@ -549,7 +549,7 @@ shell_app_open_new_window (ShellApp *app,
|
|||||||
* as say Pidgin. Ideally, we have the application express to us
|
* as say Pidgin. Ideally, we have the application express to us
|
||||||
* that it supports an explicit new-window action.
|
* that it supports an explicit new-window action.
|
||||||
*/
|
*/
|
||||||
shell_app_launch (app, 0, workspace, NULL);
|
shell_app_launch (app, 0, workspace, FALSE, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1200,12 +1200,14 @@ app_child_setup (gpointer user_data)
|
|||||||
* shell_app_launch:
|
* shell_app_launch:
|
||||||
* @timestamp: Event timestamp, or 0 for current event timestamp
|
* @timestamp: Event timestamp, or 0 for current event timestamp
|
||||||
* @workspace: Start on this workspace, or -1 for default
|
* @workspace: Start on this workspace, or -1 for default
|
||||||
|
* @discrete_gpu: Whether to start on the discrete GPU
|
||||||
* @error: A #GError
|
* @error: A #GError
|
||||||
*/
|
*/
|
||||||
gboolean
|
gboolean
|
||||||
shell_app_launch (ShellApp *app,
|
shell_app_launch (ShellApp *app,
|
||||||
guint timestamp,
|
guint timestamp,
|
||||||
int workspace,
|
int workspace,
|
||||||
|
gboolean discrete_gpu,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
ShellGlobal *global;
|
ShellGlobal *global;
|
||||||
@ -1227,6 +1229,8 @@ shell_app_launch (ShellApp *app,
|
|||||||
|
|
||||||
global = shell_global_get ();
|
global = shell_global_get ();
|
||||||
context = shell_global_create_app_launch_context (global, timestamp, workspace);
|
context = shell_global_create_app_launch_context (global, timestamp, workspace);
|
||||||
|
if (discrete_gpu)
|
||||||
|
g_app_launch_context_setenv (context, "DRI_PRIME", "1");
|
||||||
|
|
||||||
ret = g_desktop_app_info_launch_uris_as_manager (app->info, NULL,
|
ret = g_desktop_app_info_launch_uris_as_manager (app->info, NULL,
|
||||||
context,
|
context,
|
||||||
|
@ -54,6 +54,7 @@ gboolean shell_app_is_on_workspace (ShellApp *app, MetaWorkspace *workspace);
|
|||||||
gboolean shell_app_launch (ShellApp *app,
|
gboolean shell_app_launch (ShellApp *app,
|
||||||
guint timestamp,
|
guint timestamp,
|
||||||
int workspace,
|
int workspace,
|
||||||
|
gboolean discrete_gpu,
|
||||||
GError **error);
|
GError **error);
|
||||||
|
|
||||||
void shell_app_launch_action (ShellApp *app,
|
void shell_app_launch_action (ShellApp *app,
|
||||||
|
Loading…
Reference in New Issue
Block a user