ss7m / paleofetch

neofetch, but written in C
MIT License
168 stars 49 forks source link

Refactor to enable in-source configuration #13

Closed allisio closed 4 years ago

allisio commented 4 years ago

This patch adds suckless-style configuration to paleofetch, enabling the user to decide which aspects of their system are displayed.

The "config file" is just an array of structs whose components are a label and a function to be called to get the value for that label. It currently lives in main(), but this could be extracted to a header file if deemed more appropriate.

In addition, the data is vertically centered to account for the user having fewer configured labels than there are lines in the logo. This "fails" in the event that the user has more labels than logo lines, but that would at present require having duplicates, which is really more a case of operator error.

ghost commented 4 years ago

Awesome! This is great for when other operating systems than Arch Linux will be added.

ss7m commented 4 years ago

Oh wow I'm sorry I just saw this, since I just made a commit which would require a big rewrite of this. This is really good though, and pretty much exactly what I was imagining configuration for this project would look like.

allisio commented 4 years ago

Sorry about that. Accidentally pushed a different pull request to this one.

ss7m commented 4 years ago

Should I close this request then? I saw the changes you made to get_terminal and I really like them. Since XOpenDisplay is now being called in get_terminal and get_resolution, I think you should move the display to be a global alongside uname_info and my_sysinfo, that way we only have to open and close (and do error checking) once.