+static void session_setup_pid(void)
+{
+ gchar *pid = g_strdup_printf("%ld", (glong) getpid());
+
+ SmPropValue vals = {
+ .value = pid,
+ .length = strlen(pid) + 1
+ };
+ SmProp prop = {
+ .name = g_strdup(SmProcessID),
+ .type = g_strdup(SmARRAY8),
+ .num_vals = 1,
+ .vals = &vals
+ };
+ SmProp *list = ∝
+ ob_debug_type(OB_DEBUG_SM, "Setting pid: %s", pid);
+ SmcSetProperties(sm_conn, 1, &list);
+ g_free(prop.name);
+ g_free(prop.type);
+ g_free(pid);
+}
+
+/*! This is a gnome-session-manager extension */
+static void session_setup_priority(void)
+{
+ gchar priority = 20; /* 20 is a lower prioity to run before other apps */
+
+ SmPropValue vals = {
+ .value = &priority,
+ .length = 1
+ };
+ SmProp prop = {
+ .name = g_strdup("_GSM_Priority"),
+ .type = g_strdup(SmCARD8),
+ .num_vals = 1,
+ .vals = &vals
+ };
+ SmProp *list = ∝
+ ob_debug_type(OB_DEBUG_SM, "Setting priority: %d", priority);
+ SmcSetProperties(sm_conn, 1, &list);
+ g_free(prop.name);
+ g_free(prop.type);
+}
+
+static void session_setup_clone_command(void)
+{
+ gint i;
+
+ SmPropValue *vals = g_new(SmPropValue, sm_argc);
+ SmProp prop = {
+ .name = g_strdup(SmCloneCommand),
+ .type = g_strdup(SmLISTofARRAY8),
+ .num_vals = sm_argc,
+ .vals = vals
+ };
+ SmProp *list = ∝
+
+ ob_debug_type(OB_DEBUG_SM, "Setting clone command: (%d)", sm_argc);
+ for (i = 0; i < sm_argc; ++i) {
+ vals[i].value = sm_argv[i];
+ vals[i].length = strlen(sm_argv[i]) + 1;
+ ob_debug_type(OB_DEBUG_SM, " %s", vals[i].value);
+ }
+
+ SmcSetProperties(sm_conn, 1, &list);
+ g_free(prop.name);
+ g_free(prop.type);
+ g_free(vals);
+}
+
+static void session_setup_restart_command(void)
+{
+ gint i;
+
+ SmPropValue *vals = g_new(SmPropValue, sm_argc + 4);
+ SmProp prop = {
+ .name = g_strdup(SmRestartCommand),
+ .type = g_strdup(SmLISTofARRAY8),
+ .num_vals = sm_argc + 4,
+ .vals = vals
+ };
+ SmProp *list = ∝
+
+ ob_debug_type(OB_DEBUG_SM, "Setting restart command: (%d)", sm_argc+4);
+ for (i = 0; i < sm_argc; ++i) {
+ vals[i].value = sm_argv[i];
+ vals[i].length = strlen(sm_argv[i]) + 1;
+ ob_debug_type(OB_DEBUG_SM, " %s", vals[i].value);