feat: add LIDM_CONF config path override

This commit is contained in:
javalsai 2024-09-05 17:36:56 +02:00
parent 730e6db100
commit 7ca864f1d9
Signed by: javalsai
SSH Key Fingerprint: SHA256:3G83yKhBUWVABVX/vPWH88xnK4+ptMtHkZGCRXD4Mk8
3 changed files with 13 additions and 6 deletions

View File

@ -110,7 +110,7 @@ make install-service-dinit # dinit
> [service files](./assets/pkg/aur#services) have to be manually installed by now. > [service files](./assets/pkg/aur#services) have to be manually installed by now.
# Configuring # 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. 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.

View File

@ -16,13 +16,19 @@ lidm \- A text based display manager made in C
.SH ARGUMENTS .SH ARGUMENTS
.TP .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 .SH FILES
.TP .TP
\fI/etc/lidm.ini\fP\tConfig file, see \c \fI/etc/lidm.ini\fP
.BR lidm-config (5) \c Config file, see
.BR lidm-config (5)
for syntax. for syntax.

View File

@ -14,7 +14,8 @@ int main(int argc, char *argv[]) {
if (argc == 2) if (argc == 2)
chvt_str(argv[1]); 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) { if (config == NULL) {
fprintf(stderr, "error parsing config\n"); fprintf(stderr, "error parsing config\n");
return 1; return 1;