fairyglade / ly

display manager with console UI
Do What The F*ck You Want To Public License
5.33k stars 306 forks source link

Use `XDG_CONFIG_HOME` for config path instead of default config file path(in `/etc`) #550

Closed unrealapex closed 11 months ago

unrealapex commented 11 months ago

Prefer using XDG_CONFIG_HOME/ly/.config.ini over /etc/ly/config.ini to adhere with XDG specifications and allow config file to be edited without sudo permissions.

awebeer256 commented 11 months ago

Isn't the display manager an inherently system-level thing?

unrealapex commented 11 months ago

It is, however, I think that most user installed programs should have their configuration files edited in ~/.config/.

awebeer256 commented 11 months ago

What does ~ expand to? The display manager runs before any user is logged in.

This is why system-level configuration is supposed to go in /etc.

unrealapex commented 11 months ago

That's a valid point, perhaps it should stay in /etc. To answer your question, I created a cronjob: crontab -e

@reboot ~/homedir

~/homedir(/home/aaron/homedir)

#!/bin/bash
echo ~ > ~/home
$ systemctl reboot
...
$ # login in as aaron
$ cat home
/home/aaron

I am not 100% sure that the job is running before login though. Perhaps try on your system and see if results are similar.

awebeer256 commented 11 months ago

To answer your question, I created a cronjob

Unless I'm very much mistaken, that doesn't prove anything. Cron jobs run as the user whose crontab they're in, so in your example ~ will expand to the home directory of whichever user you ran crontab -e as.

My point in asking was to remind you that the display manager is (conceptually at least; I dunno about technically) run as "the system" instead of as any one user of the system. Its config has to be in /etc, because if it was in someone's home dir then only they could change the config even if they didn't have su privileges, and what if their account gets deleted, etc., etc.

unrealapex commented 11 months ago

Thank you for the good analogy. Your argument make me realize how illogical not using a system directory is. Most display managers are configured this way. I should have taken a look into that before submitting this PR. I appreciate the time you took to provide constructive criticism and helping point me in the right direction. Keep up the good work!