emersion / kanshi

Dynamic display configuration (mirror)
https://wayland.emersion.fr/kanshi/
MIT License
655 stars 46 forks source link

allow storing profiles in separate files #92

Closed jrollins closed 3 years ago

jrollins commented 3 years ago

If each profile was stored in it's own file, it seems like it would make it easier for other tools like wdisplays to manage the configs. wdisplays could just be told to export the current config to a specified kanshi profile, and then no one would need to worry about merging the profiles into a single file. kanshi could just load all the profiles and merge then on start/reload.

emersion commented 3 years ago

We already have an include directive: https://github.com/emersion/kanshi/commit/9731ff9c7983d31c11d813fa66d14d0ecb353323

I don't think we should force users to store profiles in different files.

jrollins commented 3 years ago

Was in no way suggesting that you force users to do anything. I was just suggesting that if kanshi by default could load and merge a directory of config files then it would make it much easier for integration with other tools, and users wouldn't have to specify anything in a config file for all.

For instance, a nice integration with wdisplays would be an option to save the current config. The config would be stored in file named by the profile in ~/.config/kanshi/. If kanshi just loaded and merged automatically all the config files in ~/.config/kanshi/, then the user would have to do no config whatsoever, which would be really nice. Something like this would also not required users to do anything, since they could just manage a single config in a single file in ~/.config/kanshi/, as they do now.

jrollins commented 3 years ago

I've outlined a suggestion about how some nice integration with wdisplays would work over in the wdisplays issue tracker:

https://github.com/cyclopsian/wdisplays/issues/4#issuecomment-743798545

Once this include options is available in kanshi I think this will already basically be supported. It would be great if kanshi would just automatically load all configs from ~/.config/kanshi` by default, and have wdisplay automatically store profiles in that directory, so users wouldn't have to specify anything to use wdisplays to manage configurations.

emersion commented 3 years ago

We don't ship a default config, so we can't really do that with include conf.d/*. And I don't really want to hardcode the wildcard config loading in kanshi directly.

jrollins commented 3 years ago

Is there a reason why not? kanshi by default loads one config file from ~/.config/kanshi/. Is there are reason why it would be difficult to just load all the config files from that directory? It seems to me no different that just recognizing a default include ~/.config/kanshi. It would certainly make things easier for users out of the box, and I can't see any drawback from doing so.