danyspin97 / wpaperd

Modern wallpaper daemon for Wayland
GNU General Public License v3.0
332 stars 26 forks source link

Allow changing configuration location with CLI flag #29

Closed TLATER closed 1 year ago

TLATER commented 1 year ago

Hi, I was a bit surprised by the lack of simple CLI flags given the likes of clap make it so easy; so much so that I wonder whether it's a deliberate design decision. I have a use case for at least a --config, though, so let me make my case:

While I really appreciate the support for XDG base directories, I use NixOS to deploy my system services, and due to how it manages files (places everything in /nix/store/*) it's somewhat cumbersome to get wpaperd to read its configuration - I need to symlink the store path to my home directory. This is not unusual for the distro, but it's best avoided when possible.

Being able to change the location on the command line would also make some things that nobody will ever do in practice easier, like launching multiple wpaperd instances with different settings for different sessions, or switching between configuration directories for experimentation.

Generally neither of these is a critical use case, but it's a bit odd to have an essentially hardcoded configuration location. I've kind of come to expect a --config option.

TLATER commented 1 year ago

Ignore me, I can't read.

TLATER commented 1 year ago

And ignore that too, I was looking at an outdated version, looks like the option has been removed - any particular reason for this?

danyspin97 commented 1 year ago

Hello @TLATER , thank you for the report.

like launching multiple wpaperd instances with different settings for different sessions

Can you please expand this point?

any particular reason for this?

Yes, --config has been removed because the current wpaperd.toml is not documentated nor it contains much options. wpaperd.toml had an option for setting the location to wallpaper.toml, without a cli argument. That wasn't well designed nor documented either so it has been removed. I think it's time for a config overhaul, I'll keep you updated.

Could XDG_CONFIG_HOME be set to /nix/store/* to have the same result?

TLATER commented 1 year ago

Thanks for the reply @danyspin97 :)

like launching multiple wpaperd instances with different settings for different sessions Can you please expand this point?

I would be able to have two wayland sessions on different ttys (say, one for running games and one for normal desktop use), and be able to run different wpaperd configurations on each. This is not really a common use case though, and as you mention there is a workaround with changing XDG_CONFIG_HOME...

Could XDG_CONFIG_HOME be set to /nix/store/* to have the same result?

Yes, and in practice that's what I'm currently doing:

[Install]
WantedBy=graphical-session.target

[Service]
Environment=XDG_CONFIG_HOME=/nix/store/5wccw0w8wkj63zj1hkw0hsmariawqhi3-wpaperd-config
ExecStart=/nix/store/m0pw9n93f3r2015c7sv4dibw21i3fzcb-wpaperd-0.3.0/bin/wpaperd --no-daemon

[Unit]
After=graphical-session-pre.target
Description=Wallpaper daemon
PartOf=graphical-session.target

However, since I need to have a file named exactly wpaperd/wallpaper.toml in a directory, the store path is a bit awkward to create and requires running multiple shells to build instead of just one.

Ultimately not this project's problem, and not the most important use case, but practically every other user service I've ever used would allow changing that path somewhat like this, which would be much less awkward:

wpaperd --no-daemon --config /nix/store/5wccw0w8wkj63zj1hkw0hsmariawqhi3-wallpaper.toml
danyspin97 commented 1 year ago

I have added --config and --wallpaper-config in 4bdfed9, you can use --wallpaper-config to point at the wallpaper.toml file. Please let me know if they work accordingly.