- /* don't start in showing-desktop mode */
- screen_showing_desktop = FALSE;
- PROP_SET32(RootWindow(ob_display, ob_screen),
- net_showing_desktop, cardinal, screen_showing_desktop);
+ /* start on the current desktop when a wm was already running */
+ if (PROP_GET32(RootWindow(ob_display, ob_screen),
+ net_current_desktop, cardinal, &d) &&
+ d < screen_num_desktops)
+ {
+ screen_set_desktop(d, FALSE);
+ } else if (session_desktop >= 0)
+ screen_set_desktop(MIN((guint)session_desktop,
+ screen_num_desktops), FALSE);
+ else
+ screen_set_desktop(MIN(config_screen_firstdesk,
+ screen_num_desktops) - 1, FALSE);
+
+ /* don't start in showing-desktop mode */
+ screen_showing_desktop = FALSE;
+ PROP_SET32(RootWindow(ob_display, ob_screen),
+ net_showing_desktop, cardinal, screen_showing_desktop);