Re: [dev] [dwm] hardcoded dmenucmd && dmenumon

From: Hiltjo Posthuma <hiltjo_AT_codemadness.org>
Date: Thu, 17 Feb 2022 17:39:47 +0100

On Thu, Feb 17, 2022 at 11:12:23AM +0100, Страхиња Радић wrote:
> 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.

I agree, some advantage I can think of is it would support on a multi-monitor
support with 10 or more monitors. Otherwise I prefer the current code.

-- 
Kind regards,
Hiltjo

Received on Thu Feb 17 2022 - 17:39:47 CET

This archive was generated by hypermail 2.3.0 : Thu Feb 17 2022 - 17:48:08 CET