On 22/02/17 01:08, NRK wrote:
> Assuming there isn't, one alternative could be just using env vars.
Why would an environment variable be preferable here to a command line
parameter?
Environment variables are clunky, messy, insecure, prone to errors, race
conditions and the whims of a particular setup. They should be avoided whenever
possible. The suckless way is to have configuration done in config.h instead.
In this specific example, having a separate dmenumon, which would have to be
updated, is needed because of C. It is needed to pass ASCII character for the
monitor number, which thus has to be constructed by using the expression:
'0' + selmon->num
but we can't use this expression directly in place of dmenumon to initialize
dmenucmd, because it is not allowed to have non-constant initializer elements in
C. (Try it as an exercize - you'll get a compilation error.)
I guess the room for improvement would be to move the code to reassign dmenumon
to some other (more "optimal") place than spawn function, but I don't see the
realistic gain from doing that, or need, outside of some abstract purism.
Received on Thu Feb 17 2022 - 11:12:23 CET