phillbush / xfiles

Configurable and simple file manager for X11
MIT License
97 stars 3 forks source link

self named variables #6

Closed apprehensions closed 1 year ago

apprehensions commented 1 year ago

i have changed the default variable names to add a prefix XFILES_ to be able to be distinguished from other programs. notable programs that follow this is (too many to list, listing 1 good one) nnn with variable prefix NNN_ as the primary configurator(?)

i have removed the ability to customize the HOME variable via C preprocesser because why would it need to be changed? its defined by the POSIX standard. see page 8.3 in POSIX IEEE Std 1003.1-2017

phillbush commented 1 year ago

I'm ok with the change for XFILES_FILE_ICONS, because only XFiles uses and parses its value. (Although a better name could be just XFILES_ICONS.)


On the change from OPENER to XFILES_OPENER, I prefer to have just OPENER.

The idea on environment variables is for them to be reusable between programs. Different programs use envvars like EDITOR for the default editor, BROWSER for the browser, TERM for the current terminal type, etc, rather than prefixing those envvars with their names. An OPENER environment variable can be reused by different programs and different scripts.

Personally, some of my scripts rely on an OPENER envvar, which I have set to plumb, and they fall-back to xdg-open when the envvar is not set. I know that the use of OPENER is not as widespread as EDITOR or BROWSER, but a quick search on github pointed me to a few people who rely on an OPENER environment variable in their scripts, falling back to xdg-open(1) when not set.


On the change for THUMBNAILER and THUMBNAILDIR, they are not as generic as OPENER but not as XFiles-specific as FILE_ICONS, so I have no opinion on whether to change them or not.


On defining HOME, it's just because I like to place hardcoded strings on #defines at the beginning of the source code, so I can refer to them at different points of the code just by its constant rather by its hardcoded string. This is a good programming practice, because the compiler cannot check for the correctness of a string (it can contain anything), but it can check whether a #defined constant is misspelled.

But since the "HOME" string is just used once at that getenv(3) line, referring to it via a constant is kind of not needed.

apprehensions commented 1 year ago

On the change for THUMBNAILER and THUMBNAILDIR, they are not as generic as OPENER but not as XFiles-specific as FILE_ICONS, so I have no opinion on whether to change them or not.

they should be XFILES_THUMBNAILER with XFILES_THUMBNAILDIR due to the fact that xfiles has its own thumbnailing functions, and only has the thumbnailer as a middle ground i believe. i wouldn't say it would work with other programs like OPENER.