That's how my version currently works. Unfortunately, mine likely
wouldn't be much good to you because there is a massive amount of
overhead that I added to fine-tune process controls - and I can't
merge into my github repository to demonstrate until the daily
mercurial mirror updates. Of course, your idea is actually as simple
as using popen, the non-standard function fileno, and dup2 to replace
stdin if you wanted to minimize the amount of code you touch, ie.
(somewhere in main()):

FILE *dwmhelper;
...
if(argc == 2) {
 dwmhelper  = popen(argv[1], "r");
 if(f) dup2(fileno(dwmhelper), STDIN_FILENO);
}
run();
pclose(dwmhelper);

Actually, I'm unsure that dwm didn't actually work this way by default
at one point. I seem to recall finding it somewhere in the source in
some long-lost revision once when I went repository-diving.

On Sat, Dec 6, 2008 at 10:44 PM, Guillaume Quintin
<[EMAIL PROTECTED]> wrote:
> Then use another solution. I posted a patch some hours ago, which
> requires the time.h and execute a script every second but you choose to
> execute it every hour if you like you just have to modify :
>
> int what_you_want;
> t = time(0) + what_you_want;
>
> Moreover I thought of another solution more simple for which you won't
> to modify any status script or store any data between calls. It is
> late, I am tired so I won't write a patch but I think we proceed as
> follow :
>
> You don't need any time.h functions. Before the main loop in the run()
> function you call popen("yourscript","r");
> and within the main loop, you keep select(); and fgets(); when
> necessary and display it. On breaking the main loop you pclose();
> Tomorrow I will try this unless someone write it during the night.
>
> --
> Kind regards,
> Guillaume Quintin.
>
>
>

Reply via email to