diff -upNr gnome-panel-2.22.2.orign/applets/wncklet/workspace-switcher.c gnome-panel-2.22.2/applets/wncklet/workspace-switcher.c
--- gnome-panel-2.22.2.orign/applets/wncklet/workspace-switcher.c	2008-05-26 18:10:45.000000000 +0200
+++ gnome-panel-2.22.2/applets/wncklet/workspace-switcher.c	2008-06-26 12:51:33.000000000 +0200
@@ -88,6 +88,32 @@ static void display_about_dialog      (B
 				       PagerData         *pager,
 				       const gchar       *verbname);
 
+
+static int
+wm_get_workspace_count (PagerData *pager) {
+       int num_workspaces;
+
+       GConfClient *client = gconf_client_get_default ();
+       gchar *key;
+
+       switch(pager->wm) {
+                case PAGER_WM_METACITY:
+                case PAGER_WM_UNKNOWN:
+                        num_workspaces = wnck_screen_get_workspace_count (pager->screen);
+                break;
+                case PAGER_WM_COMPIZ:
+                        key = g_strdup_printf("/apps/compiz/general/screen%d/options/hsize",
+                                wnck_screen_get_number(pager->screen));
+                        num_workspaces = gconf_client_get_int (client, key, NULL);
+                        g_free(key);
+                break;
+        }    
+
+        g_object_unref (G_OBJECT (client));        
+
+        return num_workspaces;
+}
+
 static void
 pager_update (PagerData *pager)
 {
@@ -154,7 +180,7 @@ window_manager_changed (WnckScreen *scre
 		pager->wm = PAGER_WM_UNKNOWN;
 	else if (strcmp (wm_name, "Metacity") == 0)
 		pager->wm = PAGER_WM_METACITY;
-	else if (strcmp (wm_name, "Compiz") == 0)
+	else if (strcmp (wm_name, "compiz") == 0)
 		pager->wm = PAGER_WM_COMPIZ;
 	else
 		pager->wm = PAGER_WM_UNKNOWN;
@@ -251,7 +277,7 @@ applet_scroll (PanelApplet    *applet,
 		return FALSE;
 
 	index          = wnck_workspace_get_number (wnck_screen_get_active_workspace (pager->screen));
-	n_workspaces   = wnck_screen_get_workspace_count (pager->screen);
+	n_workspaces   = wm_get_workspace_count (pager);
 	n_columns      = n_workspaces / pager->n_rows;
 	if (n_workspaces % pager->n_rows != 0)
 		n_columns++;
@@ -669,7 +695,7 @@ update_workspaces_model (PagerData *page
 	WnckWorkspace *workspace;
 	GtkTreeIter iter;
 
-	nr_ws = wnck_screen_get_workspace_count (pager->screen);
+	nr_ws = wm_get_workspace_count (pager);
         
 	if (pager->properties_dialog) {
 		if (nr_ws != gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (pager->num_workspaces_spin)))
@@ -732,13 +758,31 @@ static void
 num_workspaces_value_changed (GtkSpinButton *button,
 			      PagerData     *pager)
 {
+        GConfClient *client = gconf_client_get_default ();
+        gchar *key;
+
 	/* Slow down a bit after the first change, since it's moving really to
 	 * fast. See bug #336731 for background.
 	 * FIXME: remove this if bug 410520 gets fixed. */
 	button->timer_step = 0.2;
 
-        wnck_screen_change_workspace_count (pager->screen,
-                                            gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (pager->num_workspaces_spin)));
+        switch(pager->wm) {
+                case PAGER_WM_METACITY:
+                case PAGER_WM_UNKNOWN:
+                        wnck_screen_change_workspace_count (pager->screen,
+                           gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (pager->num_workspaces_spin)));
+                break;
+                case PAGER_WM_COMPIZ:
+                        key = g_strdup_printf("/apps/compiz/general/screen%d/options/hsize",
+                                wnck_screen_get_number(pager->screen));
+                        gconf_client_set_int (client, key,
+                            gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (pager->num_workspaces_spin)), NULL);
+                        g_free(key);
+                break;
+        }
+
+	g_object_unref (G_OBJECT (client));
+        
 }
 
 static gboolean
@@ -987,7 +1031,7 @@ setup_dialog (GladeXML  *xml,
 			  (GCallback) close_dialog, pager);
 
 	gtk_spin_button_set_value (GTK_SPIN_BUTTON (pager->num_workspaces_spin),
-				   wnck_screen_get_workspace_count (pager->screen));
+				   wm_get_workspace_count (pager));
 	g_signal_connect (G_OBJECT (pager->num_workspaces_spin), "value_changed",
 			  (GCallback) num_workspaces_value_changed, pager);
 	
