feat: add LIDM_CONF config path override

This commit is contained in:
2024-09-05 17:36:56 +02:00
parent 730e6db100
commit 7ca864f1d9
3 changed files with 13 additions and 6 deletions
+1 -1
View File
@@ -110,7 +110,7 @@ make install-service-dinit # dinit
> [service files](./assets/pkg/aur#services) have to be manually installed by now.
# Configuring
Copy any `.ini` file from [`themes/`](./themes/) (`default.ini` will always be updated) to `/etc/lidm.ini` and/or configure it to your liking. Also, don't place empty lines (for now).
Copy any `.ini` file from [`themes/`](./themes/) (`default.ini` will always be updated) to `/etc/lidm.ini` and/or configure it to your liking. Also, don't place empty lines (for now). You can also set `LIDM_CONF` environment variable to specify a config path.
Configured colors are just gonna be put inside `\x1b[...m`, ofc you can add an 'm' to break this and this can f\*ck up really bad or even make some nice UI effect possible, you should also be able to embed the `\x1b` byte in the config as I won't parse escape codes, I think that the parser is just gonna grab anything in the config file from the space after the `=` (yes, I'ma enforce that space, get good taste if you don't like it) until the newline, you can put any abomination in there. But please, keep in mind this might break easily.
+9 -3
View File
@@ -16,13 +16,19 @@ lidm \- A text based display manager made in C
.SH ARGUMENTS
.TP
[\fBTTY\fP]\tTTY to switch to, does not mean that it will run in it.
\fB[TTY]\fP
TTY to switch to, does not mean that it will run in it.
.SH ENVIRONMENT
.TP
\fBLIDM_CONF\fP
Specify the config to use other than \fI/etc/lidm.ini\fP
.SH FILES
.TP
\fI/etc/lidm.ini\fP\tConfig file, see \c
.BR lidm-config (5) \c
\fI/etc/lidm.ini\fP
Config file, see
.BR lidm-config (5)
for syntax.
+2 -1
View File
@@ -14,7 +14,8 @@ int main(int argc, char *argv[]) {
if (argc == 2)
chvt_str(argv[1]);
struct config *config = parse_config("/etc/lidm.ini");
char* conf_override = getenv("LIDM_CONF");
struct config *config = parse_config(conf_override == NULL ? "/etc/lidm.ini" : conf_override);
if (config == NULL) {
fprintf(stderr, "error parsing config\n");
return 1;