Tomas-M / xlunch

Graphical app launcher for X with minimal dependencies
http://xlunch.org
GNU General Public License v3.0
219 stars 37 forks source link

Read by default from config? #84

Closed giorgosioak closed 6 years ago

giorgosioak commented 6 years ago

Hello, can you make it read by default config in ~/.config/xlunch/config ?

Also can you make a "default" config in /etc/xlunch so users can be based on it? Mostly commented out the default values would be perfect.

My suggestion is to read by default as: ~/.config/xlunch/config /etc/xlunch/config

Thank you, G.I

PMunch commented 6 years ago

Config as in the configuration file or as in the entries file (which was previously known as the config)? It already reads ~/.config/xlunch for the entries.dsv file, so I'm guessing the config. I guess we could do that, only problem is that I think there are still some options that behave differently when unset. So not setting those options will end with functionality not obtainable by setting it to anything else. This used to be the case for spacing at least, where setting a border would lead it to not auto-calculate the border.

giorgosioak commented 6 years ago

I'm not talking about entries.

You can have the default config at /etc/xlunch/config

So if someone wants to make their own config they gonna make a new at ~/.config/xlunch/config.

Making this way allows to users to create themes and share their config and save it in dotfiles in GitHub repos. A huge plus to users that want to try themes.

I guess we could do that, only problem is that I think there are still some options that behave differently when unset.

There is no need to set them.

The /etc/... config will have a full list of default options commented out without setting them to a value.

example: #font:Sans/10

You can still have: (read with priority)

  1. user config
  2. /etc config
  3. Unset options handled by software
PMunch commented 6 years ago

Ah, that makes sense. Certainly something we could do.

I assume you mean only the options that have defaults right? Desktop mode for example, enabled with --desktop is disabled simply by leaving out desktop from a config file.

giorgosioak commented 6 years ago

@PMunch Yeah, like background, font etc.

You can make desktop:true or false or you can not accept it in config.

You know better. How you handle desktop mode now?

Also, if someone choose --config path/to/config the that ignores the user config

PMunch commented 6 years ago

Desktop mode is handled on the command line if you pass --desktop without any parameters. In the config file it is handled by the presence of desktop without any parameters. Putting it in this default config commented out might make it seem like that is the default, if we also comment out other defaults.

We could of course not comment out the actual defaults, leaving them to be read from the file, only defaulting to the internal value when the file is missing.

giorgosioak commented 6 years ago

I agree

PMunch commented 6 years ago

I've added a config file in /etc/xlunch/default.conf and made it read configs in this prioritised order:

  1. --config
  2. ~/.config/xlunch/xlunch.conf
  3. /etc/xlunch/default.conf

What do you think?

giorgosioak commented 6 years ago

Awesome!

PMunch commented 6 years ago

I'm assuming that means you're happy with the solution so I'll close this :)