Package: slim / 1.3.6-5.1

slim-add-sessiondir.patch Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
Description: Set directory that contains the xsessions
Author: Mateusz Łukasik <mati75@linuxmint.pl>
Author: Ian Stakenvicius <axs@gentoo.org>
Author: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
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<string,string> 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<string,string> session(session_name,session_exec);
+								sessions.push_back(session);
+							} else if (access(strFile.c_str(), X_OK) == 0) {
+								pair<string,string> session(string(pDirent->d_name),strFile);
+								sessions.push_back(session);
+							}
+						}
 					}
 				}
 			}
@@ -338,8 +339,18 @@
 	}
 
 	if (sessions.empty()){
-        pair<string,string> session("","");
-        sessions.push_back(session);
+		if (strSessionList.empty()) {
+			pair<string,string> session("","");
+			sessions.push_back(session);
+		} else {
+			// iterate through the split of the session list
+			vector<string> sessit;
+			split(sessit,strSessionList,',',false);
+			for (vector<string>::iterator it = sessit.begin(); it != sessit.end(); ++it) {
+				pair<string,string> 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