Hi, On Fri, Oct 04, 2013 at 06:56:56AM +0200, Florian Bruhin wrote: > * Thorsten Wißmann <edu _at_ thorsten _minus_ wissmann _dot_ de> [2013-06-24 12:53:26 +0200]: > > On Thu, Jun 20, 2013 at 10:38:07PM +0200, Florian Bruhin wrote: > > > The pid attribute will be -1 if the client didn't set it, I'm not sure > > > if this is the best solution, or if I should handle this attribute as > > > a custom string instead, and return an empty string if there is no pid > > > set. Opinions? > > > > I'd prefer the -1 option (and document it in the manpage) > > > > You also could add some description of the attributes to the manpage > > (there's already a OBJECTS section[1] describing the attributes) > > Done. > > > > HSAttribute attributes[] = { > > > + ATTRIBUTE_STRING( "tag", client->tag->display_name, ATTR_READ_ONLY), > > > > This looks wrong, because ATTRIBUTE_STRING remembers the address of the > > string you gave it. So in your case this attribute will always give the > > name of the tag the client initially was on (and it should crash as soon > > as the initial tag is removed). I recommend using a custom string > > attribute here. (ATTRIBUTE_STRING only works for strings whose address > > is constant during the livetime of the object or client in this case). > > Also done, didn't know about that, seemed logical like I did it :) > > I have to apologize about the quality of the previous patches, I was > sending out patches to the ML and was like "oh, that's also finished > and seems to work, let's send it out" without actually really testing > it :-/ Looks much better. Thanks for the patch! > +static void monitor_attr_tag(void* data, GString* output) { > + HSMonitor* m = (HSMonitor*) data; > + g_string_assign(output, m->tag->display_name->str); > +} Sorry, I never documented it yet, but output in this case is the actual output string, so you should append things to it instead of assigning them. I already modified your patch, to get this effect: $ herbstclient chain , attr monitors.focus.tag , echo > , attr clients.focus.tag mail mail (in the original code, the second attr overwrites the first line and thus only outputs a single "mail" in my case). It's pushed as: e44a549 Add tag attribute to monitor object ce529c0 Add some new client attributes Regards, Thorsten
Attachment:
pgp7xvoMcEGVx.pgp
Description: PGP signature
_______________________________________________ hlwm mailing list hlwm _at_ lists _dot_ herbstluftwm _dot_ org https://lists.schokokeks.org/mailman/listinfo.cgi/hlwm