I know this is an old post, but i stumbled across it when searching for this myself. I'm using ubuntu 12.04 and I created a patch that allows exactly what your describing.
DISCLAIMER:
This patch may stop working if gnome-shell updates, and enough changes are made to make the patch get rejected. If you wish to try it out, make sure you backup everything before applying the patch. If something goes wrong, you can restore the file and have a working desktop again.
END DISCLAIMER
Just save the bellow code in a file (eg: gnome-shell.patch):
--- /usr/share/gnome-shell/js/ui/main.js 2012-03-29 21:15:44.899552355 +0300
+++ /usr/share/gnome-shell/js/ui/main.js 2012-03-29 21:38:17.603507004 +0300
@@ -273,9 +273,20 @@
*/
const LAST_WINDOW_GRACE_TIME = 1000;
+function _getFixedWorkspaces(){
+ let settings = new Gio.Settings({ schema: 'org.gnome.fixedWorkspaces' });
+ let nr_workspaces = settings.get_int('minworkspace');
+ if (nr_workspaces == 0){
+ return 1;
+ }
+ return nr_workspaces;
+}
+
+
function _checkWorkspaces() {
let i;
let emptyWorkspaces = [];
+ let min_wrk = _getFixedWorkspaces();
if (!Meta.prefs_get_dynamic_workspaces()) {
_checkWorkspacesId = 0;
@@ -284,6 +295,7 @@
for (i = 0; i < _workspaces.length; i++) {
let lastRemoved = _workspaces[i]._lastRemovedWindow;
+ if ( i < min_wrk-1){ _workspaces[i]._keepAliveId = true; }
if ((lastRemoved &&
(lastRemoved.get_window_type() == Meta.WindowType.SPLASHSCREEN ||
lastRemoved.get_window_type() == Meta.WindowType.DIALOG ||
This patch looks for a dconf setting to determine the minimum number of workspaces you want. Create a file called org.gnome.fixedWorkspaces.gschema.xml and paste the following:
<?xml version="1.0" encoding="UTF-8"?>
<schemalist>
<schema path="/org/gnome/fixedWorkspaces/" id="org.gnome.fixedWorkspaces" gettext-domain="fixedWorkspaces">
<key type="i" name="minworkspace">
<default>4</default>
<range min="1" max="32"/>
<summary>Minimum workspaces</summary>
<description>This option sets the minimum number of desktops that the shell should stat with.</description>
</key>
</schema>
</schemalist>
Now you must copy the schema file in a location where gnome knows where to look:
cp org.gnome.fixedWorkspaces.gschema.xml /usr/share/glib-2.0/schemas/
Compile the schemas:
glib-compile-schemas /usr/share/glib-2.0/schemas/
And finally, apply the gnome-shell patch:
patch /usr/share/gnome-shell/js/ui/main.js < gnome-shell.patch
Log out, and back in and you should have a minimum of 4 workspaces (default value). You may customize the number of workspaces using dconf-editor.