Patch by Thomas Thurman which adds a new command-line switch to metacity: --ignore-screens={,{,...}} to tell metacity to avoid management of certain screens. For example, --ignore-screens=1 will tell metacity to not manage screens :?,1 (where ? is any number). Original patch here: http://bugzilla.gnome.org/show_bug.cgi?id=351647 diff -ur metacity-2.26.0.orig/src/core/display.c metacity-2.26.0/src/core/display.c --- metacity-2.26.0.orig/src/core/display.c 2009-06-24 22:29:59.000000000 +0400 +++ metacity-2.26.0/src/core/display.c 2009-06-24 22:57:21.000000000 +0400 @@ -31,6 +31,7 @@ */ #include +#include #include "display-private.h" #include "util.h" #include "main.h" @@ -309,7 +310,7 @@ * \ingroup main */ gboolean -meta_display_open (void) +meta_display_open (gchar *screens_not_to_handle) { Display *xdisplay; GSList *screens; @@ -693,16 +694,34 @@ screens = NULL; - i = 0; - while (i < ScreenCount (xdisplay)) + for (i=0; i < ScreenCount (xdisplay); i++) { - MetaScreen *screen; + char *dont_handle_cursor = + screens_not_to_handle? screens_not_to_handle: ""; + gboolean handle_this_screen = TRUE; - screen = meta_screen_new (the_display, i, timestamp); + while (*dont_handle_cursor) + { + while (*dont_handle_cursor!=0 && + *dont_handle_cursor!='-' && + (*dont_handle_cursor<'0' || *dont_handle_cursor>'9')) + dont_handle_cursor++; /* skip separators */ - if (screen) - screens = g_slist_prepend (screens, screen); - ++i; + if (*dont_handle_cursor && + strtol (dont_handle_cursor, &dont_handle_cursor, 10) == i) + { + handle_this_screen = FALSE; + break; + } + } + + if (handle_this_screen) + { + MetaScreen *screen = meta_screen_new (the_display, i, timestamp); + + if (screen) + screens = g_slist_prepend (screens, screen); + } } the_display->screens = screens; @@ -712,6 +731,8 @@ /* This would typically happen because all the screens already * have window managers. */ + meta_warning (_("Cannot start because all available screens were " + "either unavailable or ignored.\n")); meta_display_close (the_display, timestamp); return FALSE; } diff -ur metacity-2.26.0.orig/src/core/display-private.h metacity-2.26.0/src/core/display-private.h --- metacity-2.26.0.orig/src/core/display-private.h 2009-02-05 04:10:05.000000000 +0300 +++ metacity-2.26.0/src/core/display-private.h 2009-06-24 22:57:21.000000000 +0400 @@ -319,7 +319,7 @@ (time2) != 0) \ ) -gboolean meta_display_open (void); +gboolean meta_display_open (gchar *screens_not_to_handle); void meta_display_close (MetaDisplay *display, guint32 timestamp); MetaScreen* meta_display_screen_for_x_screen (MetaDisplay *display, diff -ur metacity-2.26.0.orig/src/core/main.c metacity-2.26.0/src/core/main.c --- metacity-2.26.0.orig/src/core/main.c 2009-02-05 04:10:05.000000000 +0300 +++ metacity-2.26.0/src/core/main.c 2009-06-24 23:06:38.000000000 +0400 @@ -219,6 +219,7 @@ gboolean sync; gboolean composite; gboolean no_composite; + gchar *ignore_screens; } MetaArguments; #ifdef HAVE_COMPOSITE_EXTENSIONS @@ -245,7 +246,7 @@ MetaArguments *meta_args) { MetaArguments my_args = {NULL, NULL, NULL, - FALSE, FALSE, FALSE, FALSE, FALSE}; + FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, NULL}; GOptionEntry options[] = { { "sm-disable", 0, 0, G_OPTION_ARG_NONE, @@ -300,6 +301,12 @@ N_("Turn compositing off"), NULL }, + { + "ignore-screens", 'S', 0, G_OPTION_ARG_STRING, + &my_args.ignore_screens, + N_("Comma-separated list of screens to ignore"), + NULL + }, {NULL} }; GOptionContext *ctx; @@ -526,9 +533,11 @@ if (meta_args.composite || meta_args.no_composite) meta_prefs_set_compositing_manager (meta_args.composite); - if (!meta_display_open ()) + if (!meta_display_open (meta_args.ignore_screens)) meta_exit (META_EXIT_ERROR); - + + g_free (meta_args.ignore_screens); + g_main_loop_run (meta_main_loop); meta_finalize ();