gboolean load_default_session = TRUE; preference open_files_on_same_workspace; socket.c: socket_init() ... #ifdef G_OS_WIN32 ...remains the same, ui_get_current_workspace() ::= 0 #else if (socket_info.file_name == NULL) { gchar *display_name = gdk_get_display(); gint workspace = ui_get_current_workspace(display_name); int workspace_count = ui_get_workspace_count(display_name); /* new */ gchar *hostname = utils_get_hostname(); ...prepare display_name, host_name etc... socket_info.file_name = g_strdup_printf("%s%cgeany_socket_%s_%s_ws%d", app->configdir, G_DIR_SEPARATOR, hostname, display_name, workspace); if (open_files_on_same_workspace) { check_socket_permissions(socket_info.file_name); sock = socket_fd_connect_unix(socket_info.file_name); /* don't check for a socket if the default session won't be loaded anyway */ if (sock < 0 && cl_options.load_session) { int ws; for (ws = 0; ws < workspace_count; ws++) { gchar *name; int sk; if (ws == workspace) continue; name = g_strdup_printf(..., ws); check_socket_permissions(sock_name); sk = socket_connect(sock_name); gfree(name); if (sk >= 0) { socket_close(sk); /* cl_options.load_session can't be used, so... */ load_default_session = FALSE; break; } } } } else /* first workspace (may actually be > current workspace) */ { int ws; for (ws = 0; ws < workspace_count; ws++) { gchar *sock_name = g_strdup_printf(..., ws); check_socket_permissions(sock_name); sock = socket_fd_connect_unix(socket_info.file_name); if (sock >= 0) { g_free(socket_info.file_name); socket_info.file_name = sock_name; break; } gfree(sock_name); } } g_free(display_name); g_free(hostname); } else /* socket name specified */ { check_socket_permissions(socket_info.file_name); sock = socket_fd_connect_unix(socket_info.file_name); } if (sock < 0) { remove_socket_link_full(); /* deletes the socket file and the symlink */ return socket_fd_open_unix(socket_info.file_name); } #endif ... main.c: load_startup_files() ... if (prefs.load_session) { if (load_project_from_cl) { main_load_project_from_command_line(argv[1], FALSE); } else if (cl_options.load_session && load_default_session) load_session_project_file(); /* when we want a new instance, we still load project session files unless -s * was passed */ if (!cl_options.load_session || (!load_project_from_cl && !load_default_session)) return; /* load session files into tabs, as they are found in the session_files variable */ configuration_open_files(); ...