Commit | Line | Data |
---|---|---|
6426a8fb DNB |
1 | Add "display_name" configuration option and use its value instead of |
2 | the hard coded one. | |
3 | ||
4 | Patch by Diego N. Barbato | |
5 | ||
6 | --- a/app.cpp 1970-01-01 01:00:00.000000000 +0100 | |
7 | +++ b/app.cpp 2019-04-27 13:48:23.479133531 +0200 | |
8 | @@ -190,7 +190,13 @@ | |
9 | } | |
10 | ||
11 | void App::Run() { | |
12 | - DisplayName = DISPLAY; | |
13 | + /* Read configuration */ | |
14 | + cfg = new Cfg; | |
15 | + char *cfgfile = getenv("SLIM_CFGFILE"); | |
16 | + if (!cfgfile) cfgfile = CFGFILE; | |
17 | + cfg->readConf(cfgfile); | |
18 | + | |
19 | + DisplayName = cfg->getOption("display_name").c_str(); | |
20 | ||
21 | #ifdef XNEST_DEBUG | |
22 | char* p = getenv("DISPLAY"); | |
23 | @@ -200,11 +206,7 @@ | |
24 | } | |
25 | #endif | |
26 | ||
27 | - /* Read configuration and theme */ | |
28 | - cfg = new Cfg; | |
29 | - char *cfgfile = getenv("SLIM_CFGFILE"); | |
30 | - if (!cfgfile) cfgfile = CFGFILE; | |
31 | - cfg->readConf(cfgfile); | |
32 | + /* Read theme */ | |
33 | string themebase = ""; | |
34 | string themefile = ""; | |
35 | string themedir = ""; | |
36 | @@ -911,9 +913,7 @@ | |
37 | static const int MAX_XSERVER_ARGS = 256; | |
38 | static char* server[MAX_XSERVER_ARGS+2] = { NULL }; | |
39 | server[0] = (char *)cfg->getOption("default_xserver").c_str(); | |
40 | - string argOption = cfg->getOption("xserver_arguments"); | |
41 | - /* Add mandatory -xauth option */ | |
42 | - argOption = argOption + " -auth " + cfg->getOption("authfile"); | |
43 | + string argOption = cfg->getOption("display_name") + " " + cfg->getOption("xserver_arguments") + " -auth " + cfg->getOption("authfile"); | |
44 | char* args = new char[argOption.length()+2]; /* NULL plus vt */ | |
45 | strcpy(args, argOption.c_str()); | |
46 | ||
47 | @@ -1233,7 +1233,7 @@ | |
48 | authfile = cfg->getOption("authfile"); | |
49 | remove(authfile.c_str()); | |
50 | putenv(StrConcat("XAUTHORITY=", authfile.c_str())); | |
51 | - Util::add_mcookie(mcookie, ":0", cfg->getOption("xauth_path"), | |
52 | + Util::add_mcookie(mcookie, cfg->getOption("display_name").c_str(), cfg->getOption("xauth_path"), | |
53 | authfile); | |
54 | } | |
55 | ||
56 | --- a/cfg.cpp 1970-01-01 01:00:00.000000000 +0100 | |
57 | +++ b/cfg.cpp 2019-04-27 13:49:40.511773743 +0200 | |
58 | @@ -31,6 +31,7 @@ | |
59 | /* Configuration options */ | |
60 | options.insert(option("default_path","/bin:/usr/bin:/usr/local/bin")); | |
61 | options.insert(option("default_xserver","/usr/bin/X")); | |
62 | + options.insert(option("display_name",":0.0")); | |
63 | options.insert(option("xserver_arguments","")); | |
64 | options.insert(option("numlock","")); | |
65 | options.insert(option("daemon","")); | |
66 | --- a/switchuser.cpp 1970-01-01 01:00:00.000000000 +0100 | |
67 | +++ b/switchuser.cpp 2019-04-27 13:50:19.380096651 +0200 | |
68 | @@ -54,6 +54,6 @@ | |
69 | string home = string(Pw->pw_dir); | |
70 | string authfile = home + "/.Xauthority"; | |
71 | remove(authfile.c_str()); | |
72 | - Util::add_mcookie(mcookie, ":0", cfg->getOption("xauth_path"), | |
73 | + Util::add_mcookie(mcookie, displayName.c_str(), cfg->getOption("xauth_path"), | |
74 | authfile); | |
75 | } |