Set the workspace when launching apps

main.js: Add create_app_launch_context() with code from appDisplay;
  additionally set the workspace on the launch context to the current
  workspace so that the application launches on the right workspace
  even if the user switches before the app starts.

appDisplay.js docDisplay.js: Use Main.create_app_launch_context()

http://bugzilla.gnome.org/show_bug.cgi?id=580658 (Reported by Igor Vatavuk)
This commit is contained in:
Owen W. Taylor
2009-05-01 14:13:51 -04:00
parent 4a5873dd22
commit bb69afc830
3 changed files with 25 additions and 11 deletions

View File

@ -1,6 +1,7 @@
/* -*- mode: js2; js2-basic-offset: 4; indent-tabs-mode: nil -*- */
const Clutter = imports.gi.Clutter;
const Gdk = imports.gi.Gdk;
const Gio = imports.gi.Gio;
const Mainloop = imports.mainloop;
const Meta = imports.gi.Meta;
@ -166,6 +167,21 @@ function hide_overlay() {
endModal();
}
function create_app_launch_context() {
let global = Shell.Global.get();
let screen = global.screen;
let display = screen.get_display();
let context = new Gdk.AppLaunchContext();
context.set_timestamp(display.get_current_time());
// Make sure that the app is opened on the current workspace even if
// the user switches before it seetarts
context.set_desktop(screen.get_active_workspace_index());
return context;
}
let _shellActors = [];
// For adding an actor that is part of the shell in the normal desktop view