--- gdm-2.16.0/daemon/gdm.c.org	2006-10-06 13:00:39.000000000 +0100
+++ gdm-2.16.0/daemon/gdm.c	2006-10-06 15:15:29.000000000 +0100
@@ -708,6 +708,41 @@
 		   "gdm_child_action", strerror (errno));
 }
 
+static void
+custom_cmd (void)
+{	
+
+	gdm_info (_("Executing custom command..."));
+
+	if(gdm_get_value_bool (GDM_KEY_CUSTOM_CMD_NO_RESTART) == FALSE) {
+	       gdm_final_cleanup ();
+	       VE_IGNORE_EINTR (g_chdir ("/"));
+
+#ifdef __linux__
+	       change_to_first_and_clear (TRUE);
+#endif /* __linux */
+
+	}
+
+	if ((gdm_get_value_bool (GDM_KEY_CUSTOM_CMD_NO_RESTART) == TRUE) && fork () != 0) {
+	       /* We don't have gdm/system restart option set and the creation of child process 
+		  failed if we carry on gdm will restart - we need to bail out*/
+	       gdm_error (_("%s: Creation of child process for custom command with no restart flag set failed"), 
+			  "gdm_child_action");
+	       return;
+	}
+
+	char **argv;
+	argv = ve_split (gdm_get_value_string (GDM_KEY_CUSTOM_CMD));
+	if (argv != NULL && argv[0] != NULL)
+	    VE_IGNORE_EINTR (execv (argv[0], argv));
+	
+	g_strfreev (argv);	      
+	
+	gdm_error (_("%s: Execution of custom command failed: %s"), 
+		   "gdm_child_action", strerror (errno));
+	
+}
 
 static gboolean 
 gdm_cleanup_children (void)
@@ -809,18 +844,20 @@
     if ( ! sysmenu &&
 	(status == DISPLAY_RESTARTGDM ||
 	 status == DISPLAY_REBOOT ||
+	 status == DISPLAY_CUSTOM_CMD ||
 	 status == DISPLAY_SUSPEND ||
 	 status == DISPLAY_HALT)) {
-	    gdm_info (_("Restart GDM, Restart machine, Suspend, or Halt request when there is no system menu from display %s"), d->name);
+	    gdm_info (_("Restart GDM, Restart machine, Execute custom cmd, Suspend, or Halt request when there is no system menu from display %s"), d->name);
 	    status = DISPLAY_REMANAGE;
     }
 
     if ( ! d->attached &&
 	(status == DISPLAY_RESTARTGDM ||
 	 status == DISPLAY_REBOOT ||
+	 status == DISPLAY_CUSTOM_CMD ||
 	 status == DISPLAY_SUSPEND ||
 	 status == DISPLAY_HALT)) {
-	    gdm_info (_("Restart GDM, Restart machine, Suspend or Halt request from a non-static display %s"), d->name);
+	    gdm_info (_("Restart GDM, Restart machine, Execute custom cmd, Suspend or Halt request from a non-static display %s"), d->name);
 	    status = DISPLAY_REMANAGE;
     }
 
@@ -862,6 +899,10 @@
 	    if (gdm_get_value_string (GDM_KEY_REBOOT) == NULL)
 		    status = DISPLAY_REMANAGE;
 	    break;
+    case DISPLAY_CUSTOM_CMD:
+	    if (gdm_get_value_string (GDM_KEY_CUSTOM_CMD) == NULL)
+		    status = DISPLAY_REMANAGE;
+	    break;
     case DISPLAY_HALT:
 	    if (gdm_get_value_string (GDM_KEY_HALT) == NULL)
 		    status = DISPLAY_REMANAGE;
@@ -901,6 +942,9 @@
     case DISPLAY_REBOOT:	/* Restart machine */
 	restart_machine ();
 
+    case DISPLAY_CUSTOM_CMD:       /* Custom command */
+	custom_cmd ();
+
 	status = DISPLAY_REMANAGE;
 	goto start_autopsy;
 	break;
@@ -1075,6 +1119,10 @@
 		restart_machine ();
 		break;
 
+	case GDM_LOGOUT_ACTION_CUSTOM_CMD:
+	       custom_cmd ();
+	       break;
+
 	case GDM_LOGOUT_ACTION_SUSPEND:
 		suspend_machine ();
 		break;
@@ -2383,6 +2431,19 @@
 
 			send_slave_ack (d, NULL);
 		}
+	} else if (strncmp (msg, GDM_SOP_CUSTOM_CMD " ",
+		            strlen (GDM_SOP_CUSTOM_CMD " ")) == 0) {
+		GdmDisplay *d;
+		long slave_pid;
+
+		if (sscanf (msg, GDM_SOP_CUSTOM_CMD " %ld", &slave_pid) != 1)
+			return;
+		d = gdm_display_lookup (slave_pid);
+
+		if (d != NULL) {
+		        custom_cmd();
+			send_slave_ack (d, NULL);
+		}		
 	} else if (strcmp (msg, GDM_SOP_FLEXI_XSERVER) == 0) {
 		handle_flexi_server (NULL, TYPE_FLEXI, gdm_get_value_string (GDM_KEY_STANDARD_XSERVER),
 				     TRUE /* handled */,
@@ -3257,6 +3318,13 @@
 			sep = ";";
 		}
 		if (sysmenu && disp->attached &&
+		    ! ve_string_empty (gdm_get_value_string (GDM_KEY_CUSTOM_CMD))) {
+			g_string_append_printf (msg, "%s%s", sep, GDM_SUP_LOGOUT_ACTION_CUSTOM_CMD);
+			if (logout_action == GDM_LOGOUT_ACTION_CUSTOM_CMD)
+				g_string_append (msg, "!");
+			sep = ";";
+		}
+		if (sysmenu && disp->attached &&
 		    ! ve_string_empty (gdm_get_value_string (GDM_KEY_SUSPEND))) {
 			g_string_append_printf (msg, "%s%s", sep, GDM_SUP_LOGOUT_ACTION_SUSPEND);
 			if (logout_action == GDM_LOGOUT_ACTION_SUSPEND)
@@ -3305,6 +3373,13 @@
 					GDM_LOGOUT_ACTION_REBOOT;
 				was_ok = TRUE;
 			}
+		} else if (strcmp (action, GDM_SUP_LOGOUT_ACTION_CUSTOM_CMD) == 0) {
+			if (sysmenu && disp->attached &&
+			    ! ve_string_empty (gdm_get_value_string (GDM_KEY_CUSTOM_CMD))) {
+				disp->logout_action =
+					GDM_LOGOUT_ACTION_CUSTOM_CMD;
+				was_ok = TRUE;
+			}
 		} else if (strcmp (action, GDM_SUP_LOGOUT_ACTION_SUSPEND) == 0) {
 			if (sysmenu && disp->attached &&
 			    ! ve_string_empty (gdm_get_value_string (GDM_KEY_SUSPEND))) {
@@ -3358,6 +3433,13 @@
 					GDM_LOGOUT_ACTION_REBOOT;
 				was_ok = TRUE;
 			}
+		} else if (strcmp (action, GDM_SUP_LOGOUT_ACTION_CUSTOM_CMD) == 0) {
+		       if (sysmenu && disp->attached &&
+			    ! ve_string_empty (gdm_get_value_string (GDM_KEY_CUSTOM_CMD))) {
+				safe_logout_action =
+					GDM_LOGOUT_ACTION_CUSTOM_CMD;
+				was_ok = TRUE;
+			}
 		} else if (strcmp (action, GDM_SUP_LOGOUT_ACTION_SUSPEND) == 0) {
 			if (sysmenu && disp->attached &&
 			    ! ve_string_empty (gdm_get_value_string (GDM_KEY_SUSPEND))) {
--- gdm-2.16.0/daemon/gdmconfig.c.org	2006-10-06 12:55:52.000000000 +0100
+++ gdm-2.16.0/daemon/gdmconfig.c	2006-10-06 12:59:53.000000000 +0100
@@ -115,6 +115,11 @@
 static gchar *GdmXKeepsCrashing = NULL;
 static gchar *GdmHalt = NULL;
 static gchar *GdmReboot = NULL;
+static gchar *GdmCustomCmd = NULL;
+static gchar *GdmCustomCmdLabel = NULL;
+static gchar *GdmCustomCmdLRLabel = NULL;
+static gchar *GdmCustomCmdText = NULL;
+static gchar *GdmCustomCmdTooltip = NULL;
 static gchar *GdmSuspend = NULL;
 static gchar *GdmServAuthDir = NULL;
 static gchar *GdmMulticastAddr;
@@ -192,6 +197,7 @@
 static gboolean GdmSoundOnLoginSuccess = FALSE;
 static gboolean GdmSoundOnLoginFailure = FALSE;
 static gboolean GdmConsoleNotify = TRUE;
+static gboolean GdmCustomCmdNoRestart = FALSE;
 
 /* Config options used by slave */
 /* ---------------------------- */
@@ -418,6 +424,7 @@
    gdm_config_add_hash (GDM_KEY_SOUND_ON_LOGIN, &GdmSoundOnLogin, &bool_type);
    gdm_config_add_hash (GDM_KEY_RESTART_BACKGROUND_PROGRAM,
       &GdmRestartBackgroundProgram, &bool_type);
+   gdm_config_add_hash (GDM_KEY_CUSTOM_CMD_NO_RESTART, &GdmCustomCmdNoRestart, &bool_type);
 
    /* string values */
    gdm_config_add_hash (GDM_KEY_PATH, &GdmPath, &string_type);
@@ -438,6 +445,11 @@
    gdm_config_add_hash (GDM_KEY_AUTOMATIC_LOGIN, &GdmAutomaticLogin, &string_type);
    gdm_config_add_hash (GDM_KEY_GTK_MODULES_LIST, &GdmGtkModulesList, &string_type);
    gdm_config_add_hash (GDM_KEY_REBOOT, &GdmReboot, &string_type);
+   gdm_config_add_hash (GDM_KEY_CUSTOM_CMD, &GdmCustomCmd, &string_type);
+   gdm_config_add_hash (GDM_KEY_CUSTOM_CMD_LABEL, &GdmCustomCmdLabel, &string_type);
+   gdm_config_add_hash (GDM_KEY_CUSTOM_CMD_LR_LABEL, &GdmCustomCmdLRLabel, &string_type);
+   gdm_config_add_hash (GDM_KEY_CUSTOM_CMD_TEXT, &GdmCustomCmdText, &string_type);
+   gdm_config_add_hash (GDM_KEY_CUSTOM_CMD_TOOLTIP, &GdmCustomCmdTooltip, &string_type);
    gdm_config_add_hash (GDM_KEY_HALT, &GdmHalt, &string_type);
    gdm_config_add_hash (GDM_KEY_SUSPEND, &GdmSuspend, &string_type);
    gdm_config_add_hash (GDM_KEY_LOG_DIR, &GdmLogDir, &string_type);
@@ -1079,6 +1091,7 @@
    /* Halt, Reboot, and Suspend commands */
    } else if (is_key (key, GDM_KEY_HALT) ||
               is_key (key, GDM_KEY_REBOOT) ||
+	      is_key (key, GDM_KEY_CUSTOM_CMD) ||
               is_key (key, GDM_KEY_SUSPEND)) {
        if (value != NULL)
           *setting = ve_get_first_working_command (value, FALSE);
--- gdm-2.16.0/daemon/gdm.h.org	2006-10-06 13:45:17.000000000 +0100
+++ gdm-2.16.0/daemon/gdm.h	2006-10-06 15:17:26.000000000 +0100
@@ -71,6 +71,7 @@
 #define DISPLAY_SUSPEND 17	/* Suspend (don't use, use the interrupt) */
 #define DISPLAY_CHOSEN 20	/* successful chooser session,
 				   restart display */
+#define DISPLAY_CUSTOM_CMD 21   /* Custom command */
 #define DISPLAY_RUN_CHOOSER 30	/* Run chooser */
 #define DISPLAY_XFAILED 64	/* X failed */
 #define DISPLAY_GREETERFAILED 65 /* greeter failed (crashed) */
@@ -127,6 +128,7 @@
 #define GDM_INTERRUPT_SELECT_USER 'U'
 #define GDM_INTERRUPT_LOGIN_SOUND 'L'
 #define GDM_INTERRUPT_THEME       'H'
+#define GDM_INTERRUPT_CUSTOM_CMD  'M'
 #define GDM_INTERRUPT_CANCEL      'X'
 
 /* List delimiter for config file lists */
@@ -234,6 +236,12 @@
 #define GDM_KEY_FAILSAFE_XSERVER "daemon/FailsafeXServer="
 #define GDM_KEY_X_KEEPS_CRASHING "daemon/XKeepsCrashing=" GDMCONFDIR "/XKeepsCrashing"
 #define GDM_KEY_REBOOT  "daemon/RebootCommand=" REBOOT_COMMAND
+#define GDM_KEY_CUSTOM_CMD "daemon/CustomCommand=" CUSTOM_COMMAND
+#define GDM_KEY_CUSTOM_CMD_LABEL "daemon/CustomCommandLabel=" CUSTOM_COMMAND_LABEL
+#define GDM_KEY_CUSTOM_CMD_LR_LABEL "daemon/CustomCommandLRLabel=" CUSTOM_COMMAND_LR_LABEL
+#define GDM_KEY_CUSTOM_CMD_TEXT "daemon/CustomCommandText=" CUSTOM_COMMAND_TEXT
+#define GDM_KEY_CUSTOM_CMD_TOOLTIP "daemon/CustomCommandTooltip=" CUSTOM_COMMAND_TOOLTIP
+#define GDM_KEY_CUSTOM_CMD_NO_RESTART "daemon/CustomCommandNoRestart=" CUSTOM_COMMAND_NO_RESTART
 #define GDM_KEY_ROOT_PATH "daemon/RootPath=/sbin:/usr/sbin:" GDM_USER_PATH
 #define GDM_KEY_SERV_AUTHDIR "daemon/ServAuthDir=" AUTHDIR
 #define GDM_KEY_SESSION_DESKTOP_DIR "daemon/SessionDesktopDir=/etc/X11/sessions/:" DMCONFDIR "/Sessions/:" DATADIR "/gdm/BuiltInSessions/:" DATADIR "/xsessions/"
@@ -437,6 +445,7 @@
 	GDM_LOGOUT_ACTION_NONE = 0,
 	GDM_LOGOUT_ACTION_HALT,
 	GDM_LOGOUT_ACTION_REBOOT,
+	GDM_LOGOUT_ACTION_CUSTOM_CMD,
 	GDM_LOGOUT_ACTION_SUSPEND,
 	GDM_LOGOUT_ACTION_LAST
 } GdmLogoutAction;
@@ -707,6 +716,9 @@
 #define GDM_SOP_SUSPEND_MACHINE "SUSPEND_MACHINE"  /* no arguments */
 #define GDM_SOP_CHOSEN_THEME "CHOSEN_THEME"  /* <slave pid> <theme name> */
 
+/*Execute custom cmd*/
+#define GDM_SOP_CUSTOM_CMD "CUSTOM_CMD"  /* <slave pid> */
+
 /* Start a new standard X flexible server */
 #define GDM_SOP_FLEXI_XSERVER "FLEXI_XSERVER" /* no arguments */
 
@@ -1192,10 +1204,11 @@
  *      200 = Too many messages
  *      999 = Unknown error
  */
-#define GDM_SUP_LOGOUT_ACTION_NONE	"NONE"
-#define GDM_SUP_LOGOUT_ACTION_HALT	"HALT"
-#define GDM_SUP_LOGOUT_ACTION_REBOOT	"REBOOT"
-#define GDM_SUP_LOGOUT_ACTION_SUSPEND	"SUSPEND"
+#define GDM_SUP_LOGOUT_ACTION_NONE	 "NONE"
+#define GDM_SUP_LOGOUT_ACTION_HALT	 "HALT"
+#define GDM_SUP_LOGOUT_ACTION_REBOOT	 "REBOOT"
+#define GDM_SUP_LOGOUT_ACTION_CUSTOM_CMD "CUSTOM_CMD"
+#define GDM_SUP_LOGOUT_ACTION_SUSPEND	 "SUSPEND"
 /*
  */
 #define GDM_SUP_QUERY_VT "QUERY_VT" /* None */
--- gdm-2.16.0/daemon/slave.c.org	2006-10-06 13:49:37.000000000 +0100
+++ gdm-2.16.0/daemon/slave.c	2006-10-06 13:50:57.000000000 +0100
@@ -4676,6 +4676,7 @@
 		if (WIFEXITED (status) &&
 		    (WEXITSTATUS (status) == DISPLAY_ABORT ||
 		     WEXITSTATUS (status) == DISPLAY_REBOOT ||
+		     WEXITSTATUS (status) == DISPLAY_CUSTOM_CMD ||
 		     WEXITSTATUS (status) == DISPLAY_HALT ||
 		     WEXITSTATUS (status) == DISPLAY_SUSPEND ||
 		     WEXITSTATUS (status) == DISPLAY_RUN_CHOOSER ||
@@ -4954,6 +4955,18 @@
 		case GDM_INTERRUPT_CANCEL:
 			do_cancel = TRUE;
 			break;
+		case GDM_INTERRUPT_CUSTOM_CMD:
+			if (d->attached &&
+			    gdm_get_value_bool (GDM_KEY_CUSTOM_CMD_NO_RESTART) &&
+			    ! ve_string_empty (gdm_get_value_string (GDM_KEY_CUSTOM_CMD))) {
+				gchar *msg = g_strdup_printf ("%s %ld", 
+					GDM_SOP_CUSTOM_CMD,
+					(long)getpid ());
+
+				gdm_slave_send (msg, TRUE);
+				g_free (msg);
+			}
+			return TRUE;
 		case GDM_INTERRUPT_THEME:
 			g_free (d->theme_name);
 			d->theme_name = NULL;
--- gdm-2.16.0/gui/gdmlogin.c.org	2006-10-06 13:51:56.000000000 +0100
+++ gdm-2.16.0/gui/gdmlogin.c	2006-10-06 13:56:41.000000000 +0100
@@ -669,6 +669,27 @@
 	}
 }
 
+static void
+gdm_custom_cmd_handler (void)
+{
+	if (gdm_wm_warn_dialog (
+	    ((ve_string_empty (gdm_config_get_string (GDM_KEY_CUSTOM_CMD_TEXT))) ? 
+	    _("Are you sure?") : gdm_config_get_string (GDM_KEY_CUSTOM_CMD_TEXT)) , "", GTK_STOCK_OK, NULL, TRUE) == GTK_RESPONSE_YES) {
+	
+		if(gdm_config_get_bool (GDM_KEY_CUSTOM_CMD_NO_RESTART) == FALSE) {
+
+			closelog ();
+			
+			gdm_kill_thingies ();			
+
+			_exit (DISPLAY_CUSTOM_CMD);
+		}		
+		else {
+			printf ("%c%c%c\n", STX, BEL, GDM_INTERRUPT_CUSTOM_CMD);
+			fflush (stdout);
+		}
+	}
+}
 
 static void
 gdm_login_halt_handler (void)
@@ -2379,6 +2400,17 @@
 		got_anything = TRUE;
 	}
 	
+	if (gdm_working_command_exists (gdm_config_get_string (GDM_KEY_CUSTOM_CMD))) {
+		item = gtk_menu_item_new_with_mnemonic (((ve_string_empty (gdm_config_get_string (GDM_KEY_CUSTOM_CMD_LABEL))) ? 
+						        _("_Custom") : gdm_config_get_string (GDM_KEY_CUSTOM_CMD_LABEL)));
+		gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
+		g_signal_connect (G_OBJECT (item), "activate",
+				  G_CALLBACK (gdm_custom_cmd_handler), 
+				  NULL);
+		gtk_widget_show (GTK_WIDGET (item));
+		got_anything = TRUE;
+	}
+
 	if (gdm_working_command_exists (gdm_config_get_string (GDM_KEY_HALT))) {
 		item = gtk_menu_item_new_with_mnemonic (_("Shut _Down"));
 		gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
@@ -2967,6 +2999,11 @@
         gdm_config_get_string (GDM_KEY_LOCALE_FILE);
 	gdm_config_get_string (GDM_KEY_LOGO);
         gdm_config_get_string (GDM_KEY_REBOOT);
+	gdm_config_get_string (GDM_KEY_CUSTOM_CMD);
+	gdm_config_get_string (GDM_KEY_CUSTOM_CMD_LABEL);
+	gdm_config_get_string (GDM_KEY_CUSTOM_CMD_LR_LABEL);
+	gdm_config_get_string (GDM_KEY_CUSTOM_CMD_TEXT);
+	gdm_config_get_string (GDM_KEY_CUSTOM_CMD_TOOLTIP);
         gdm_config_get_string (GDM_KEY_REMOTE_WELCOME);
 	gdm_config_get_string (GDM_KEY_SESSION_DESKTOP_DIR);
 	gdm_config_get_string (GDM_KEY_SOUND_PROGRAM);
@@ -3009,6 +3046,7 @@
 	gdm_config_get_bool   (GDM_KEY_SYSTEM_MENU);
 	gdm_config_get_bool   (GDM_KEY_TIMED_LOGIN_ENABLE);
         gdm_config_get_bool   (GDM_KEY_TITLE_BAR);
+	gdm_config_get_bool   (GDM_KEY_CUSTOM_CMD_NO_RESTART);
 
 	/* Keys not to include in reread_config */
 	gdm_config_get_bool   (GDM_KEY_LOCK_POSITION);
@@ -3060,6 +3098,11 @@
 	    gdm_config_reload_string (GDM_KEY_INFO_MSG_FONT) ||
 	    gdm_config_reload_string (GDM_KEY_LOCALE_FILE) ||
 	    gdm_config_reload_string (GDM_KEY_REBOOT) ||
+	    gdm_config_reload_string (GDM_KEY_CUSTOM_CMD) ||
+	    gdm_config_reload_string (GDM_KEY_CUSTOM_CMD_TEXT) ||
+	    gdm_config_reload_string (GDM_KEY_CUSTOM_CMD_LABEL) ||
+	    gdm_config_reload_string (GDM_KEY_CUSTOM_CMD_LR_LABEL) ||
+	    gdm_config_reload_string (GDM_KEY_CUSTOM_CMD_TOOLTIP) ||
 	    gdm_config_reload_string (GDM_KEY_SESSION_DESKTOP_DIR) ||
 	    gdm_config_reload_string (GDM_KEY_SUSPEND) ||
 	    gdm_config_reload_string (GDM_KEY_TIMED_LOGIN) ||
@@ -3089,6 +3132,7 @@
 	    gdm_config_reload_bool   (GDM_KEY_SHOW_XTERM_FAILSAFE) ||
 	    gdm_config_reload_bool   (GDM_KEY_SYSTEM_MENU) ||
 	    gdm_config_reload_bool   (GDM_KEY_TIMED_LOGIN_ENABLE) ||
+	    gdm_config_reload_bool   (GDM_KEY_CUSTOM_CMD_NO_RESTART) ||
 	    gdm_config_reload_bool   (GDM_KEY_TITLE_BAR)) {
 
 		/* Set busy cursor */
--- gdm-2.16.0/gui/greeter/greeter.c.org	2006-10-06 13:58:59.000000000 +0100
+++ gdm-2.16.0/gui/greeter/greeter.c	2006-10-06 14:06:59.000000000 +0100
@@ -66,12 +66,25 @@
 GtkWidget *window;
 GtkWidget *canvas;
 
-gboolean GDM_IS_LOCAL          = FALSE;
-static gboolean ignore_buttons = FALSE;
-gboolean GdmHaltFound          = FALSE;
-gboolean GdmRebootFound        = FALSE;
-gboolean GdmSuspendFound       = FALSE;
-gboolean GdmConfiguratorFound  = FALSE;
+gboolean GDM_IS_LOCAL             = FALSE;
+static gboolean ignore_buttons    = FALSE;
+gboolean GdmHaltFound             = FALSE;
+gboolean GdmRebootFound           = FALSE;
+gboolean GdmCustomCmdFound        = FALSE;
+gboolean GdmCustomCmdTextFound    = FALSE;
+gboolean GdmCustomCmdLabelFound   = FALSE;
+gboolean GdmCustomCmdLRLabelFound = FALSE;
+gboolean GdmCustomCmdTooltipFound = FALSE;
+gboolean GdmSuspendFound          = FALSE;
+gboolean GdmConfiguratorFound     = FALSE;
+
+gchar *GdmCustomCmd = NULL;
+gchar *GdmCustomCmdLabel = NULL;
+gchar *GdmCustomCmdLRLabel = NULL;
+gchar *GdmCustomCmdText = NULL;
+gchar *GdmCustomCmdTooltip = NULL;
+
+gboolean GdmCustomCmdNoRestart = FALSE;
 
 /* FIXME: hack */
 GreeterItemInfo *welcome_string_info = NULL;
@@ -737,6 +750,11 @@
 	gdm_config_get_string (GDM_KEY_LOCALE_FILE);
 	gdm_config_get_string (GDM_KEY_HALT);
 	gdm_config_get_string (GDM_KEY_REBOOT);
+	gdm_config_get_string (GDM_KEY_CUSTOM_CMD);
+	gdm_config_get_string (GDM_KEY_CUSTOM_CMD_TEXT);
+	gdm_config_get_string (GDM_KEY_CUSTOM_CMD_LABEL);
+	gdm_config_get_string (GDM_KEY_CUSTOM_CMD_LR_LABEL);
+	gdm_config_get_string (GDM_KEY_CUSTOM_CMD_TOOLTIP);
 	gdm_config_get_string (GDM_KEY_SUSPEND);
 	gdm_config_get_string (GDM_KEY_CONFIGURATOR);
 	gdm_config_get_string (GDM_KEY_INFO_MSG_FILE);
@@ -773,6 +791,7 @@
 	gdm_config_get_bool   (GDM_KEY_SOUND_ON_LOGIN);
 	gdm_config_get_bool   (GDM_KEY_DEFAULT_WELCOME);
 	gdm_config_get_bool   (GDM_KEY_DEFAULT_REMOTE_WELCOME);
+	gdm_config_get_bool   (GDM_KEY_CUSTOM_CMD_NO_RESTART);
 
 	/* Keys not to include in reread_config */
 	gdm_config_get_string (GDM_KEY_SESSION_DESKTOP_DIR);
@@ -805,6 +824,11 @@
 	    gdm_config_reload_string (GDM_KEY_LOCALE_FILE) ||
 	    gdm_config_reload_string (GDM_KEY_HALT) ||
 	    gdm_config_reload_string (GDM_KEY_REBOOT) ||
+	    gdm_config_reload_string (GDM_KEY_CUSTOM_CMD) ||
+	    gdm_config_reload_string (GDM_KEY_CUSTOM_CMD_TEXT) ||
+	    gdm_config_reload_string (GDM_KEY_CUSTOM_CMD_LABEL) ||
+	    gdm_config_reload_string (GDM_KEY_CUSTOM_CMD_LR_LABEL) ||
+	    gdm_config_reload_string (GDM_KEY_CUSTOM_CMD_TOOLTIP) ||
 	    gdm_config_reload_string (GDM_KEY_SUSPEND) ||
 	    gdm_config_reload_string (GDM_KEY_CONFIGURATOR) ||
 	    gdm_config_reload_string (GDM_KEY_INFO_MSG_FILE) ||
@@ -832,6 +856,7 @@
 	    gdm_config_reload_bool   (GDM_KEY_GRAPHICAL_THEME_RAND) ||
 	    gdm_config_reload_bool   (GDM_KEY_SHOW_LAST_SESSION) ||
 	    gdm_config_reload_bool   (GDM_KEY_ALLOW_ROOT) ||
+	    gdm_config_reload_bool   (GDM_KEY_CUSTOM_CMD_NO_RESTART) ||
 	    gdm_config_reload_bool   (GDM_KEY_ALLOW_REMOTE_ROOT)) {
 
 		/* Set busy cursor */
@@ -1146,12 +1171,32 @@
   * is displayed it doesn't show as 0.  Also determine if the Halt,
   * Reboot, Suspend and Configurator commands work.
   */
-  gdm_timed_delay      = gdm_config_get_int (GDM_KEY_TIMED_LOGIN_DELAY);
-  GdmHaltFound         = gdm_working_command_exists (gdm_config_get_string (GDM_KEY_HALT));
-  GdmRebootFound       = gdm_working_command_exists (gdm_config_get_string (GDM_KEY_REBOOT));
-  GdmSuspendFound      = gdm_working_command_exists (gdm_config_get_string (GDM_KEY_SUSPEND));
-  GdmConfiguratorFound = gdm_working_command_exists (gdm_config_get_string (GDM_KEY_CONFIGURATOR));
+  gdm_timed_delay            = gdm_config_get_int (GDM_KEY_TIMED_LOGIN_DELAY);
+  GdmHaltFound               = gdm_working_command_exists (gdm_config_get_string (GDM_KEY_HALT));
+  GdmRebootFound             = gdm_working_command_exists (gdm_config_get_string (GDM_KEY_REBOOT));
+  GdmCustomCmdFound          = gdm_working_command_exists (gdm_config_get_string (GDM_KEY_CUSTOM_CMD));
+  GdmCustomCmdTextFound      = !ve_string_empty (gdm_config_get_string (GDM_KEY_CUSTOM_CMD_TEXT));
+  GdmCustomCmdLabelFound     = !ve_string_empty (gdm_config_get_string (GDM_KEY_CUSTOM_CMD_LABEL));
+  GdmCustomCmdLRLabelFound   = !ve_string_empty (gdm_config_get_string (GDM_KEY_CUSTOM_CMD_LR_LABEL));
+  GdmCustomCmdTooltipFound   = !ve_string_empty (gdm_config_get_string (GDM_KEY_CUSTOM_CMD_TOOLTIP));
+  GdmCustomCmdNoRestart      = gdm_config_get_bool (GDM_KEY_CUSTOM_CMD_NO_RESTART);
+  GdmSuspendFound            = gdm_working_command_exists (gdm_config_get_string (GDM_KEY_SUSPEND));
+  GdmConfiguratorFound       = gdm_working_command_exists (gdm_config_get_string (GDM_KEY_CONFIGURATOR));
+
+  if(GdmCustomCmdFound)
+      GdmCustomCmd = gdm_config_get_string (GDM_KEY_CUSTOM_CMD);
+
+  if(GdmCustomCmdLabelFound)
+      GdmCustomCmdLabel = gdm_config_get_string (GDM_KEY_CUSTOM_CMD_LABEL);
+
+  if(GdmCustomCmdLRLabelFound)
+      GdmCustomCmdLRLabel = gdm_config_get_string (GDM_KEY_CUSTOM_CMD_LR_LABEL);
+  
+  if(GdmCustomCmdTextFound)
+      GdmCustomCmdText = gdm_config_get_string (GDM_KEY_CUSTOM_CMD_TEXT);
 
+  if(GdmCustomCmdTooltipFound)
+      GdmCustomCmdTooltip = gdm_config_get_string (GDM_KEY_CUSTOM_CMD_TOOLTIP);
 
   if (g_getenv ("GDM_THEME") != NULL)
      gdm_graphical_theme = g_strdup (g_getenv ("GDM_THEME"));
--- gdm-2.16.0/gui/greeter/greeter_parser.c.org	2006-10-06 14:09:53.000000000 +0100
+++ gdm-2.16.0/gui/greeter/greeter_parser.c	2006-10-06 14:10:59.000000000 +0100
@@ -355,6 +355,12 @@
 	  g_free (*translated_text);
 	  *translated_text = g_strdup (_("_Restart"));
 	}
+      else if (g_ascii_strcasecmp ((char *) prop, "custom_cmd") == 0)
+        {
+	  g_free (*translated_text);	  
+	  *translated_text = g_strdup (((GdmCustomCmdLabelFound == TRUE) ? 
+				       GdmCustomCmdLabel : _("_Custom")));
+	}
       else if (g_ascii_strcasecmp ((char *) prop, "chooser") == 0)
         {
 	  g_free (*translated_text);
--- gdm-2.16.0/gui/greeter/greeter_item.c.org	2006-10-06 14:08:18.000000000 +0100
+++ gdm-2.16.0/gui/greeter/greeter_item.c	2006-10-06 14:09:32.000000000 +0100
@@ -35,6 +35,7 @@
 
 extern gboolean GdmHaltFound;
 extern gboolean GdmRebootFound;
+extern gboolean GdmCustomCmdFound;
 extern gboolean GdmSuspendFound;
 extern gboolean GdmConfiguratorFound;
 
@@ -204,6 +205,10 @@
       (info->show_type != NULL &&
        strcmp (info->show_type, "reboot") == 0))
 	  return FALSE;
+  if (( ! sysmenu || ! GdmCustomCmdFound) &&
+      (info->show_type != NULL &&
+       strcmp (info->show_type, "custom_cmd") == 0))
+	  return FALSE;
   if (( ! sysmenu || ! GdmSuspendFound) &&
       (info->show_type != NULL &&
        strcmp (info->show_type, "suspend") == 0))
--- gdm-2.16.0/gui/greeter/greeter.dtd.org	2006-10-06 14:07:30.000000000 +0100
+++ gdm-2.16.0/gui/greeter/greeter.dtd	2006-10-06 14:07:55.000000000 +0100
@@ -19,7 +19,7 @@
 <!-- additional elements-->
 <!ELEMENT border EMPTY>
 
-<!-- internal id's are one of (user-pw-entry | caps-lock-warning | clock | pam-error | pam-message | pam-prompt | pam-warning | timed-label | language_button | disconnect_button | reboot_button | halt_button | session_button | suspend_button | system_button | config_button | chooser_button | userlist)
+<!-- internal id's are one of (user-pw-entry | caps-lock-warning | clock | pam-error | pam-message | pam-prompt | pam-warning | timed-label | language_button | disconnect_button | reboot_button | custom_cmd_button | halt_button | session_button | suspend_button | system_button | config_button | chooser_button | userlist)
      but there can be other id's -->
 <!ATTLIST item
 	type (rect | entry | pixmap | label | svg | rect | list) #REQUIRED
--- gdm-2.16.0/gui/greeter/greeter_system.c.org	2006-10-06 14:11:49.000000000 +0100
+++ gdm-2.16.0/gui/greeter/greeter_system.c	2006-10-06 14:17:57.000000000 +0100
@@ -39,9 +39,22 @@
 GtkWidget *dialog;
 extern gboolean GdmHaltFound;
 extern gboolean GdmRebootFound;
+extern gboolean GdmCustomCmdFound;
+extern gboolean GdmCustomCmdTextFound;
+extern gboolean GdmCustomCmdLabelFound;
+extern gboolean GdmCustomCmdLRLabelFound;
+extern gboolean GdmCustomCmdTooltipFound;
 extern gboolean GdmSuspendFound;
 extern gboolean GdmConfiguratorFound;
 
+extern gboolean GdmCustomCmdNoRestart;
+
+extern gchar *GdmCustomCmd;
+extern gchar *GdmCustomCmdLabel;
+extern gchar *GdmCustomCmdLRLabel;
+extern gchar *GdmCustomCmdTooltip;
+extern gchar *GdmCustomCmdText;
+
 /* doesn't check for executability, just for existance */
 static gboolean
 bin_exists (const char *command)
@@ -79,6 +92,26 @@
 }
 
 static void
+query_greeter_custom_cmd_handler (void)
+{
+        if (gdm_wm_warn_dialog (((GdmCustomCmdTextFound == TRUE) ? GdmCustomCmdText : _("Are you sure?")), "",
+				GTK_STOCK_OK, NULL, TRUE) == GTK_RESPONSE_YES) {
+
+	        if(GdmCustomCmdNoRestart == FALSE) {
+
+		    closelog ();
+
+		    _exit (DISPLAY_CUSTOM_CMD);
+		
+		}		
+		else {
+		    printf ("%c%c%c\n", STX, BEL, GDM_INTERRUPT_CUSTOM_CMD);
+		    fflush (stdout);
+		}
+	}
+}
+
+static void
 query_greeter_halt_handler (void)
 {
 	if (gdm_wm_warn_dialog (_("Are you sure you want to Shut Down the computer?"), "",
@@ -107,6 +140,19 @@
 	_exit (DISPLAY_REBOOT);
 }
 
+static void
+greeter_custom_cmd_handler (void)
+{
+        if(GdmCustomCmdNoRestart == FALSE) {
+	    closelog ();	    
+
+	    _exit (DISPLAY_CUSTOM_CMD);
+	}	
+	else {
+	    printf ("%c%c%c\n", STX, BEL, GDM_INTERRUPT_CUSTOM_CMD);
+	    fflush (stdout);
+	}
+}
 
 static void
 greeter_halt_handler (void)
@@ -174,7 +220,7 @@
 				  NULL);
 	}
 
-	if (GdmRebootFound || GdmHaltFound || GdmSuspendFound) {
+	if (GdmRebootFound || GdmHaltFound || GdmSuspendFound || GdmCustomCmdFound) {
 		sep = gtk_separator_menu_item_new ();
 		gtk_menu_shell_append (GTK_MENU_SHELL (menu), sep);
 		gtk_widget_show (sep);
@@ -189,6 +235,15 @@
 				  NULL);
 	}
 
+	if (GdmCustomCmdFound) {
+	        w = gtk_menu_item_new_with_mnemonic (((GdmCustomCmdLabelFound == TRUE) ? GdmCustomCmdLabel : _("_Custom")));
+		gtk_menu_shell_append (GTK_MENU_SHELL (menu), w);
+		gtk_widget_show (GTK_WIDGET (w));
+		g_signal_connect (G_OBJECT (w), "activate",
+				  G_CALLBACK (query_greeter_custom_cmd_handler),
+				  NULL);
+	}
+
 	if (GdmHaltFound) {
 		w = gtk_menu_item_new_with_mnemonic (_("Shut _Down"));
 		gtk_menu_shell_append (GTK_MENU_SHELL (menu), w);
@@ -232,6 +287,7 @@
   GtkWidget *halt_radio = NULL;
   GtkWidget *suspend_radio = NULL;
   GtkWidget *restart_radio = NULL;
+  GtkWidget *custom_cmd_radio = NULL;
   GtkWidget *config_radio = NULL;
   GtkWidget *chooser_radio = NULL;
   gchar *s;
@@ -316,6 +372,24 @@
 	  gtk_widget_show (restart_radio);
   }
 
+  if (GdmCustomCmdFound) {
+	  if (group_radio != NULL)
+		  radio_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (group_radio));
+	  custom_cmd_radio = gtk_radio_button_new_with_mnemonic (radio_group,
+							     ((GdmCustomCmdLRLabelFound == TRUE) ? GdmCustomCmdLRLabel : 
+							      _("_Execute custom command")));
+	  group_radio = custom_cmd_radio;
+	  gtk_tooltips_set_tip (tooltips, GTK_WIDGET (custom_cmd_radio),
+				((GdmCustomCmdTooltipFound == TRUE) ? GdmCustomCmdTooltip : _("Execute custom command")),
+				NULL);
+	  g_signal_connect (G_OBJECT(custom_cmd_radio), "button_press_event",
+			    G_CALLBACK(radio_button_press_event), NULL);
+	  gtk_box_pack_start (GTK_BOX (vbox),
+			      custom_cmd_radio,
+			      FALSE, FALSE, 4);
+	  gtk_widget_show (custom_cmd_radio);
+  }
+
   if (GdmSuspendFound) {
 	  if (group_radio != NULL)
 		  radio_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (group_radio));
@@ -399,6 +473,8 @@
     greeter_halt_handler ();
   else if (restart_radio != NULL && gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (restart_radio)))
     greeter_restart_handler ();
+  else if (custom_cmd_radio != NULL && gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (custom_cmd_radio)))
+    greeter_custom_cmd_handler ();
   else if (suspend_radio != NULL && gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (suspend_radio)))
     greeter_suspend_handler ();
   else if (config_radio != NULL && gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (config_radio)))
@@ -416,6 +492,9 @@
   greeter_item_register_action_callback ("reboot_button",
 					 (ActionFunc)query_greeter_restart_handler,
 					 NULL);
+  greeter_item_register_action_callback ("custom_cmd_button",
+					 (ActionFunc)query_greeter_custom_cmd_handler,
+					 NULL);
   greeter_item_register_action_callback ("halt_button",
 					 (ActionFunc)query_greeter_halt_handler,
 					 NULL);
--- gdm-2.16.0/gui/greeter/greeter_configuration.h.org	2006-10-06 13:57:50.000000000 +0100
+++ gdm-2.16.0/gui/greeter/greeter_configuration.h	2006-10-06 13:58:39.000000000 +0100
@@ -29,10 +29,21 @@
 extern gboolean GdmChooserButton;
 extern gchar *GdmHalt;
 extern gchar *GdmReboot;
+extern gchar *GdmCustomCmd;
+extern gchar *GdmCustomCmdText;
+extern gchar *GdmCustomCmdLabel;
+extern gchar *GdmCustomCmdLRLabel;
+extern gchar *GdmCustomCmdTooltip;
 extern gchar *GdmSuspend;
 extern gchar *GdmConfigurator;
 extern gboolean GdmHaltFound;
 extern gboolean GdmRebootFound;
+extern gboolean GdmCustomCmdFound;
+extern gboolean GdmCustomCmdTextFound;
+extern gboolean GdmCustomCmdLabelFound;
+extern gboolean GdmCustomCmdLRLabelFound;
+extern gboolean GdmCustomCmdTooltipFound;
+extern gboolean GdmCustomCmdNoRestart;
 extern gboolean GdmSuspendFound;
 extern gboolean GdmConfiguratorFound;
 extern gchar *GdmSessionDir;
--- gdm-2.16.0/acconfig.h.org	2006-10-06 12:53:29.000000000 +0100
+++ gdm-2.16.0/acconfig.h	2006-10-06 12:53:53.000000000 +0100
@@ -3,6 +3,12 @@
 #undef GETTEXT_PACKAGE
 #undef HALT_COMMAND
 #undef REBOOT_COMMAND
+#undef CUSTOM_COMMAND
+#undef CUSTOM_COMMAND_TEXT
+#undef CUSTOM_COMMAND_LR_LABEL
+#undef CUSTOM_COMMAND_LABEL
+#undef CUSTOM_COMMAND_TOOLTIP
+#undef CUSTOM_COMMAND_NO_RESTART
 #undef SOUND_PROGRAM
 #undef SUSPEND_COMMAND
 #undef ENABLE_IPV6
--- gdm-2.16.0/AUTHORS.org	2006-10-06 14:33:18.000000000 +0100
+++ gdm-2.16.0/AUTHORS	2006-10-06 14:33:39.000000000 +0100
@@ -76,6 +76,7 @@
 	Lee Mallabone <lee0@callnetuk.com>
 	Leena Gunda <leena.gunda@wipro.com>
 	Luis Villa <louie@ximian.com>
+	Lukasz Zalewski <lukas@dcs.qmul.ac.uk>
 	Mark McLoughlin <mark@skynet.ie>
 	Mathieu Lacage <mathieu@eazel.com>
 	Matt Forrest <mforrest@scs.ryerson.ca>
--- gdm-2.16.0/ChangeLog.org	2006-10-06 14:33:53.000000000 +0100
+++ gdm-2.16.0/ChangeLog	2006-10-06 15:01:21.000000000 +0100
@@ -0,0 +1,32 @@
+2006-09-05  Lukasz Zalewski  <lukas@dcs.qmul.ac.uk>
+
+        * Release 2.16.0:
+	* daemon/gdmconfig.c: Added variables & functions used to read/store 
+	  CustomCommand related values
+	* daemon/gdm.c (custom_cmd): New function that handles 
+	  execution of CustomCommand
+	* daemon/gdm. [ch]: Updated macros and several functions to accomodate 
+	  new CustomCommand functionality
+	* daemon/slave.c: Added Custom command interrupt handler to handle 
+	  the CustomCommand when gdm/system restart is not required
+	* gui/gdmlogin.c (gdm_custom_cmd_handler): New function that handles 
+	  execution of CustomCommand
+	* gui/gdmlogin.c: Added variables and updated several functions to accomodate 
+	  new CustomCommand functionality
+	* gui/greeter/greeter_configuration.h: Added variables used to 
+	  store CustomCommand related values
+	* gui/greeter/greeter.c: Added variables that use/store 
+	  CustomCommand related values
+	* gui/greeter/greeter.dtd: Added custom_cmd_button as 
+	  one of the internal id for stock buttons
+	* gui/greeter/greeter_item.c: Added visibility check for custom_cmd related widgets
+	* gui/greeter/greeter_parser.c: Added code for parsing custom_cmd stock items
+	* gui/greeter/greeter_system.c (greeter_custom_cmd_handler): New function that 
+	  handles execution of CustomCommand
+	* gui/greeter/greeter_system.c (query_greeter_custom_cmd_handler): New function that 
+	  handles execution of CustomCommand (with warn message query beforehand)
+	* gui/greeter/greeter_system.c: Updated macros and several functions to accomodate 
+	  new CustomCommand functionality
+        * configure.ac: Updated to accomodate new CustomCommand functionality
+	* acconfig.h: Updated to accomodate new CustomCommand functionality
+	
--- gdm-2.16.0/config/gdm.conf.in.org	2006-10-06 17:38:02.000000000 +0100
+++ gdm-2.16.0/config/gdm.conf.in	2006-10-06 17:38:32.000000000 +0100
@@ -202,6 +202,22 @@
 # kills it.  10 seconds should be long enough for X, but Xgl may need 20 or 25. 
 GdmXserverTimeout=10
 
+# Custom command path, you can add different commands separated by 
+# by a semicolon.  GDM will use the first one it can find.
+#CustomCommand=/usr/sbin/bootwindoze;/sbin/bootwindoze
+# NOTE: All of the below options are not valid without CustomCommand
+# Custom command dialog message that will appear on all warning dialogs.
+#CustomCommandText=Are you sure you want to restart system into Windoze?
+# Custom command label that will appear as stock label on buttons/menu items
+#CustomCommandLabel=_Windoze
+# Custom command label that will appear as stock label on radio buttons/list items
+#CustomCommandLRLabel=Restart into _Windoze
+# Custom command tooltip
+#CustomCommandTooltip=Restarts the computer into Windoze
+# Custom command gdm/system restart option. Setting it to true will restart gdm after
+# command execution.
+#CustomCommandNoRestart=false
+
 [security]
 # Allow root to login.  It makes sense to turn this off for kiosk use, when
 # you want to minimize the possibility of break in.
--- gdm-2.16.0/configure.ac.org	2006-10-06 12:54:36.000000000 +0100
+++ gdm-2.16.0/configure.ac	2006-10-06 12:55:05.000000000 +0100
@@ -1059,6 +1059,18 @@
 AC_DEFINE_UNQUOTED(HALT_COMMAND,"$HALT_COMMAND")
 AC_SUBST(REBOOT_COMMAND)
 AC_DEFINE_UNQUOTED(REBOOT_COMMAND,"$REBOOT_COMMAND")
+AC_SUBST(CUSTOM_COMMAND)
+AC_DEFINE_UNQUOTED(CUSTOM_COMMAND,"$CUSTOM_COMMAND")
+AC_SUBST(CUSTOM_COMMAND_TEXT)
+AC_DEFINE_UNQUOTED(CUSTOM_COMMAND_TEXT,"$CUSTOM_COMMAND_TEXT")
+AC_SUBST(CUSTOM_COMMAND_LR_LABEL)
+AC_DEFINE_UNQUOTED(CUSTOM_COMMAND_LR_LABEL,"$CUSTOM_COMMAND_LR_LABEL")
+AC_SUBST(CUSTOM_COMMAND_LABEL)
+AC_DEFINE_UNQUOTED(CUSTOM_COMMAND_LABEL,"$CUSTOM_COMMAND_LABEL")
+AC_SUBST(CUSTOM_COMMAND_TOOLTIP)
+AC_DEFINE_UNQUOTED(CUSTOM_COMMAND_TOOLTIP,"$CUSTOM_COMMAND_TOOLTIP")
+AC_SUBST(CUSTOM_COMMAND_NO_RESTART)
+AC_DEFINE_UNQUOTED(CUSTOM_COMMAND_NO_RESTART,"$CUSTOM_COMMAND_NO_RESTART")
 AC_SUBST(SUSPEND_COMMAND)
 AC_DEFINE_UNQUOTED(SUSPEND_COMMAND,"$SUSPEND_COMMAND")
 AC_SUBST(XSESSION_SHELL)
--- gdm-2.16.0/docs/C/gdm.xml.org	2006-10-06 14:20:38.000000000 +0100
+++ gdm-2.16.0/docs/C/gdm.xml	2006-10-06 14:29:28.000000000 +0100
@@ -170,7 +170,7 @@
         (ServAuthDir, PidFile, etc.), system applications (SoundProgram), etc.
         Some configuration values depend on OS interfaces may need to be
         modified to work on a given OS.  Typical examples are HaltCommand,
-        RebootCommand, SuspendCommand, StandardXServer, Xnest, SoundProgram,
+        RebootCommand, CustomCommand, SuspendCommand, StandardXServer, Xnest, SoundProgram,
         and the &quot;command&quot; value for each &quot;server-foo&quot;.
       </para>
 
@@ -1856,6 +1856,82 @@
           </varlistentry>
           
           <varlistentry>
+            <term>CustomCommand</term>
+            <listitem>
+              <synopsis>CustomCommand=</synopsis>
+              <para>
+                Full path and arguments to command to be executed when user
+                selects &quot;Custom Command&quot; from the Actions menu.  This can
+                be a ';' separated list of commands to try.  If a value is
+                missing, the custom command is not available.  By 
+                default this value is not enabled, so to enable 
+                &quot;Custom Command&quot; it must be
+                set to a nonempty value.
+              </para>
+            </listitem>
+          </varlistentry>
+          
+          <varlistentry>
+            <term>CustomCommandLabel</term>
+            <listitem>
+              <synopsis>CustomCommandLabel=</synopsis>
+              <para>
+                Specifies the stock label that will be displayed on the &quot;Custom Command&quot;
+                buttons and menu items. If not specified the default value is  &quot;_Custom&quot;. This 
+                option is only valid if <filename>CustomCommand</filename> is defined.
+              </para>
+            </listitem>
+          </varlistentry>
+          
+          <varlistentry>
+            <term>CustomCommandLRLabel</term>
+            <listitem>
+              <synopsis>CustomCommandLRLabel=</synopsis>
+              <para>
+                Specifies the stock label that will be displayed on the &quot;Custom Command&quot;
+                list items and radio buttons. If not specified the default value is  &quot;_Execute custom command&quot;. This 
+                option is only valid if <filename>CustomCommand</filename> is defined.
+              </para>
+            </listitem>
+          </varlistentry>
+          
+          <varlistentry>
+            <term>CustomCommandNoRestart</term>
+            <listitem>
+              <synopsis>CustomCommandNoRestart=</synopsis>
+              <para>
+                Specifies if gdm will be stopped/restarted once &quot;Custom Command&quot;
+                has been executed. If not specified the default value is  &quot;false&quot;. 
+                This option is only valid if <filename>CustomCommand</filename> is defined.
+              </para>
+            </listitem>
+          </varlistentry>
+          
+          <varlistentry>
+            <term>CustomCommandText</term>
+            <listitem>
+              <synopsis>CustomCommandText=</synopsis>
+              <para>
+                Specifies the message that will be displayed on the warning dialog box once &quot;Custom Command&quot;
+                button/menu item/radio button/list item has been activated. If not specified the default value is  &quot;Are you sure?&quot;. 
+                This option is only valid if <filename>CustomCommand</filename> is defined.
+              </para>
+            </listitem>
+          </varlistentry>
+          
+          <varlistentry>
+            <term>CustomCommandTooltip</term>
+            <listitem>
+              <synopsis>CustomCommandTooltip=</synopsis>
+              <para>
+                Specifies the message that will be displayed on tooltips for &quot;Custom Command&quot;
+                entries. If not specified the default value is  &quot;Execute custom command&quot;. This 
+                option is only valid if <filename>CustomCommand</filename> is defined.
+              </para>
+            </listitem>
+          </varlistentry>
+          
+          <varlistentry>
             <term>DefaultPath</term>
             <listitem>
               <synopsis>DefaultPath=defaultpath (value set by configure)</synopsis>
@@ -6857,6 +6933,46 @@
         chooser to the other X terminals.
       </para>
     </sect2>
+    
+    <sect2 id="customcommand">
+      <title>Defining Custom Command Option</title>
+      
+      <para>
+        Suppose you want to add a command to the login manager that 
+        will give you the oportunity to boot into other operating system such as Windoze.
+        You need to add the following options into the <filename>[daemon]</filename> 
+        section of your GDM configuration file.
+        
+        <screen>
+          [daemon]
+          CustomCommand=/sbin/rebootwindoze;/usr/local/sbin/rebootwindoze
+          CustomCommandLabel=_Windoze
+          CustomCommandLRLabel=Reboot into _Windoze
+          CustomCommandText=Are you sure you want to restart the computer into Windoze?
+          CustomCommandTooltip=Restarts the computer into Windoze
+        </screen>
+        Where <filename>/sbin/rebootwindoze</filename> and 
+        <filename>/usr/local/sbin/rebootwindoze</filename> are the potential scripts 
+        that will perform the reboot action (at least one of them must exist).
+      </para>
+      <para>
+        Note, that besides being able to customise this option to reboot into different operating systems
+        you can also use it for your own custom behaviours that you want to run from gdm without stopping
+        or restarting. it. Suppose you want to give users the oportunity to run system update scripts at
+        their leasure. You need to add the following options into the <filename>[daemon]</filename> 
+        section of your GDM configuration file.
+        
+        <screen>
+          [daemon]
+          CustomCommand=/sbin/updatesystem;/usr/local/sbin/updatesystem
+          CustomCommandLabel=_Update Me
+          CustomCommandLRLabel=Update the system
+          CustomCommandText=Are you sure you want to update the system software?
+          CustomCommandTooltip=Updates the system
+          CustomCommandNoRestart=true
+        </screen>
+      </para>
+    </sect2>
   </sect1>
 
   <sect1 id="troubleshooting">
