waycrate / swhkd

Sxhkd clone for Wayland (works on TTY and X11 too)
https://git.sr.ht/~shinyzenith/swhkd
BSD 2-Clause "Simplified" License
690 stars 47 forks source link

feat: generate default config if not exists #249

Open Parag003 opened 7 months ago

Parag003 commented 7 months ago

Currently SWHKD leads to a config error if the file at the default config path is missing (/etc/swhkd/swhkdrc).

This PR adds a mechanism to generate a default config (populated with an example from man 5 swhkd), the generated config is commented out by default.

Parag003 commented 7 months ago

Resolves #201

Shinyzenith commented 7 months ago

Hi, while this is a good pr I am not a fan of the inline file writing we are doing as everytime we introduce new features, the examples need to be put into this file.

It's ideally the distributions responsibility during packaging to provide a sample config -- just how programs like sway and alacritty have theirs defaulted to by the distribution.

@zubairmh What do you think?

zubairmh commented 7 months ago

Hi, while this is a good pr I am not a fan of the inline file writing we are doing as everytime we introduce new features, the examples need to be put into this file.

It's ideally the distributions responsibility during packaging to provide a sample config -- just how programs like sway and alacritty have theirs defaulted to by the distribution.

@zubairmh What do you think?

We could have a default config in codebase that copies itself to the config path upon the first extension startup, something like in the sway codebase here. This PR could easily be modified to do something like that. @Shinyzenith

Shinyzenith commented 7 months ago

I think having a example config would be nice but the copying function is responsbility of the distribution as they like to patch configs before pushing to users. Having the file in the repo means we need to bake it into the binary to finally write to disk -- increasing binary size.

Parag003 commented 7 months ago

@Shinyzenith any solutions for this?

Shinyzenith commented 7 months ago

I think this pr would be better to just introduce a default config -- also lets discuss patches in the github issue before forming the pr -- I don't want any contributor to feel like their efforts are going to waste. This way we get to discuss about the project goals and if the pr is a good idea 😊

Parag003 commented 7 months ago

Hmm sure @Shinyzenith ill add the new issue