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 #250

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).

So the pr #249 i made was using a mechanism to generate a default config from example config , but as discussed with @Shinyzenith we could find i better way to do this.

InnocentZero commented 6 months ago

One way to go about this would be to get the latest swhkdrc from the github repository itself, either through Rust APIs or by running an external git command.

See here for examples of the external git command.

Pros of running git externally : dead easy and simple.

Cons: Rust can't handle the errors by itself. Also kind of a hacky way to do it.

Pros of getting it through some Rust API: Better interop with existing code. Can be handled in code completely without making external calls. Better error handling.

Cons: Depending on the framework, it can bloat the codebase by a lot.