Description: Set directory that contains the xsessions Author: Mateusz Łukasik Author: Ian Stakenvicius Author: Nobuhiro Iwamatsu Bug-Debian: http://bugs.debian.org/740394 --- a/cfg.cpp 2013-10-01 18:38:05.000000000 -0400 +++ b/cfg.cpp 2013-10-24 12:12:20.584103253 -0400 @@ -274,14 +274,14 @@ while (true) { string::const_iterator begin = s; while (*s != c && s != str.end()) { ++s; } - tmp = string(begin, s); - if (useEmpty || tmp.size() > 0) + tmp = string(begin, s); + if (useEmpty || tmp.size() > 0) v.push_back(tmp); if (s == str.end()) { break; } if (++s == str.end()) { - if (useEmpty) + if (useEmpty) v.push_back(""); break; } @@ -289,6 +289,7 @@ } void Cfg::fillSessionList(){ + string strSessionList = getOption("sessions"); string strSessionDir = getOption("sessiondir"); sessions.clear(); @@ -307,29 +308,29 @@ struct stat oFileStat; if (stat(strFile.c_str(), &oFileStat) == 0) { - if (S_ISREG(oFileStat.st_mode) && - access(strFile.c_str(), R_OK) == 0){ - ifstream desktop_file( strFile.c_str() ); - if (desktop_file){ - string line, session_name = "", session_exec = ""; - while (getline( desktop_file, line )) { - if (line.substr(0, 5) == "Name=") { - session_name = line.substr(5); - if (!session_exec.empty()) - break; - } else - if (line.substr(0, 5) == "Exec=") { - session_exec = line.substr(5); - if (!session_name.empty()) - break; - } - } - desktop_file.close(); - pair session(session_name,session_exec); - sessions.push_back(session); - cout << session_exec << " - " << session_name << endl; - } - + if (S_ISREG(oFileStat.st_mode) && + access(strFile.c_str(), R_OK) == 0){ + ifstream desktop_file( strFile.c_str() ); + if (desktop_file){ + string line, session_name = "", session_exec = ""; + while (getline( desktop_file, line )) { + if (line.substr(0, 5) == "Name=") { + session_name = line.substr(5); + if (!session_exec.empty()) break; + } else if (line.substr(0, 5) == "Exec=") { + session_exec = line.substr(5); + if (!session_name.empty()) break; + } + } + desktop_file.close(); + if (!session_name.empty() && !session_exec.empty()) { + pair session(session_name,session_exec); + sessions.push_back(session); + } else if (access(strFile.c_str(), X_OK) == 0) { + pair session(string(pDirent->d_name),strFile); + sessions.push_back(session); + } + } } } } @@ -338,8 +339,18 @@ } if (sessions.empty()){ - pair session("",""); - sessions.push_back(session); + if (strSessionList.empty()) { + pair session("",""); + sessions.push_back(session); + } else { + // iterate through the split of the session list + vector sessit; + split(sessit,strSessionList,',',false); + for (vector::iterator it = sessit.begin(); it != sessit.end(); ++it) { + pair session(*it,*it); + sessions.push_back(session); + } + } } } --- a/app.cpp 2013-10-24 12:16:59.870111072 -0400 +++ b/app.cpp 2013-10-24 12:29:59.899132910 -0400 @@ -377,10 +377,6 @@ LoginPanel->SetName(cfg->getOption("default_user") ); } - if (firstloop) { - LoginPanel->SwitchSession(); - } - if (!AuthenticateUser(focuspass && firstloop)){ panelclosed = 0; firstloop = false; --- a/slim.conf +++ b/slim.conf @@ -47,11 +47,9 @@ login_cmd exec /bin/bash -login ~/.xinitrc %session # options "-d" and "-nodaemon" # daemon yes -# Available sessions (first one is the default). -# The current chosen session name is replaced in the login_cmd -# above, so your login command can handle different sessions. -# see the xinitrc.sample file shipped with slim sources -sessions xfce4,icewm-session,wmaker,blackbox +# Set directory that contains the xsessions. +# slim reads xsesion from this directory, and be able to select. +sessiondir /usr/share/xsessions/ # Executed when pressing F11 (requires imagemagick) screenshot_cmd import -window root /slim.png -- cgit v0.9.2