[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] consequence: hook
- To: Tyler Thomas Hart <htyler _at_ pdx _dot_ edu>
- Subject: Re: [PATCH] consequence: hook
- From: Thorsten Wißmann <edu _at_ thorsten _minus_ wissmann _dot_ de>
- Date: Tue, 25 Dec 2012 15:14:15 +0100
Hi,
On Mon, Dec 24, 2012 at 09:14:35PM -0800, Tyler Thomas Hart wrote:
> On Mon, Dec 24, 2012 at 04:18:18PM +0100, Thorsten Wi?mann wrote:
> > The main thing is, that the rule should not directly emit the specified
> > hook but a hook called "rule" with a customizable parameter.
>
> Agreed. I included a colon eg. 'rule:', feel free to change it back as
> you see fit.
I changed it back. Each hook (like a command) is an array of strings,
e.g:
fullscreen on 0x1000009
rule myfancyrulename
rule a_wild_firefox_appears
so one can listen to it e.g. using: herbstclient -i fullscreen. Waiting
for the next firefox: herbstclient --wait rule a_wild_firefox_appears
But is *not* just one line, so there must not be an extra separator,
especially no colon.
> > So the first possible solution is:
> >
> > char* hook_str[] = { "rule", cons->value.str };
> > hook_emit(LENGTH(hook_str), hook_str);
> >
> > And the second possibility is:
> >
> > hook_emit_list("rule", cons->value.str, NULL);
>
> I went with the first choice. As with my suggestion on irc, avoiding
> the call to g_new and the va loop in emit_list() seems more efficient.
>
> I've attached the amended patch. If you want to make any other
> changes, feel free to make them.
OK. But efficiency of the code at this point is not the bottleneck when doing
X-communication.
Your patch now is upstream as:
40fb7a3 Add consequence: hook
Regards,
Thorsten