Skip to content

Commit 491b6a8

Browse files
committed
Add a config option specifying themes directory
1 parent 66af90e commit 491b6a8

File tree

5 files changed

+6
-4
lines changed

5 files changed

+6
-4
lines changed

app.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ void App::Run()
232232
if (testing) {
233233
themeName = testtheme;
234234
} else {
235-
themebase = string(THEMESDIR) + "/";
235+
themebase = cfg.getOption("themes_dir") + "/";
236236
themeName = cfg.getOption("current_theme");
237237
string::size_type pos;
238238
if ((pos = themeName.find(",")) != string::npos) {
@@ -1252,7 +1252,7 @@ string App::findValidRandomTheme(const string & set)
12521252
int sel = Util::random() % themes.size();
12531253

12541254
name = Cfg::Trim(themes[sel]);
1255-
themefile = string(THEMESDIR) + "/" + name + THEMESFILE;
1255+
themefile = cfg.getOption("themes_dir") + "/" + name + THEMESFILE;
12561256
if (stat(themefile.c_str(), &buf) != 0) {
12571257
themes.erase(find(themes.begin(), themes.end(), name));
12581258
logStream << APPNAME << ": Invalid theme in config: " << name

cfg.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ Cfg::Cfg() : currentSession(-1)
5656
options.insert(option("default_user", ""));
5757
options.insert(option("focus_password", "no"));
5858
options.insert(option("auto_login", "no"));
59+
options.insert(option("themes_dir", PKGDATADIR "/themes"));
5960
options.insert(option("current_theme", "default"));
6061
options.insert(option("lockfile", "/var/run/slim.lock"));
6162
options.insert(option("logfile", "/dev/stderr"));

cfg.h

-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
#define INPUT_MAXLENGTH_PASSWD 50
2020

2121
#define CFGFILE SYSCONFDIR "/slim.conf"
22-
#define THEMESDIR PKGDATADIR "/themes"
2322
#define THEMESFILE "/slim.theme"
2423

2524
class Cfg

slim.conf

+2
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,8 @@ reboot_msg The system is rebooting...
9292
# the password. Set to "yes" to enable this feature
9393
#auto_login no
9494

95+
# Directory containing themes
96+
#themes_dir /usr/share/slim/themes
9597

9698
# current theme, use comma separated list to specify a set to
9799
# randomly choose from

slimlock.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ int main(int argc, char ** argv)
112112
string themefile = "";
113113
string themedir = "";
114114
themeName = "";
115-
themebase = string(THEMESDIR) + "/";
115+
themebase = cfg.getOption("themes_dir") + "/";
116116
themeName = cfg.getOption("current_theme");
117117
string::size_type pos;
118118
if ((pos = themeName.find(",")) != string::npos) {

0 commit comments

Comments
 (0)