autoWorkspaces: fix creation of new workspaces with application launchers

In the workspace-collecting code we add a check to avoid collecting a
workspace if any startup sequence is running there. Since the sequence
can take some time to load, an helper function is also added which keeps
the (empty) workspace around for a very short time, while waiting for the
sequence to start.

https://bugzilla.gnome.org/show_bug.cgi?id=664202
This commit is contained in:
Stefano Facchini
2012-02-17 15:57:27 +01:00
parent b2bc73c3fe
commit 3c6737f738
4 changed files with 43 additions and 6 deletions

View File

@ -25,6 +25,8 @@ const SLIDE_ANIMATION_TIME = 0.2;
// placeholder exactly.
const WORKSPACE_CUT_SIZE = 10;
const WORKSPACE_KEEP_ALIVE_TIME = 100;
const WindowClone = new Lang.Class({
Name: 'WindowClone',
@ -684,9 +686,16 @@ const ThumbnailsBox = new Lang.Class({
// ... and bam, a workspace, good as new.
source.metaWindow.change_workspace_by_index(newWorkspaceIndex,
true, time);
else if (source.shellWorkspaceLaunch)
else if (source.shellWorkspaceLaunch) {
source.shellWorkspaceLaunch({ workspace: newWorkspaceIndex,
timestamp: time });
// This new workspace will be automatically removed if the application fails
// to open its first window within some time, as tracked by Shell.WindowTracker.
// Here, we only add a very brief timeout to avoid the _immediate_ removal of the
// workspace while we wait for the startup sequence to load.
Main.keepWorkspaceAlive(global.screen.get_workspace_by_index(newWorkspaceIndex),
WORKSPACE_KEEP_ALIVE_TIME);
}
return true;
},