Re: Signals on spawned clients
Thanks a lot for clarifying, Uli. I'm using 3.4.6-1, which is the stable version on Debian Squeeze, so I get nil as a result of awesome.spawn(). I published the mailbar on the wiki[1] as I'll leave it as is until I find a way to get feedback from spawned clients. Thanks again, drebs. [1] https://awesome.naquadah.org/wiki/Email_notification_with_mutt_integration -- __o _`\,_ (*)/ (*) Em Wed, Apr 20, 2011 at 07:08:00PM +0200, Uli Schlachter escreveu: On 20.04.2011 13:18, drebs wrote: The awesome api doc[1] says that awful.util.spawn's return value is awesome.spawn. When print awesome.spawn's type, I get a function type. But when I set a variable with the result of the spawn function, i get 'nil' as its type. No idea what you are looking at, but since 3.4.8, awesome.spawn() returns the PID in case of success and a string with an error message in case of error. Before 3.4.8, it returns nil for success and a string for error messages. Also, just starting something doesn't mean that a new window appears. You could e.g. do awesome.spawn(sleep 10) without getting a new window. It's actually quite hard to map a spawn()-call to the resulting window. No idea if it works, but you could give this a try (assuming you get the pid from spawn()): pid = awesome.spawn(terminal .. -e \sleep 5\) client.add_signal(unmanage, function(c) if c.pid ~= pid then return end print(c, disappears!) end -- Do you know that books smell like nutmeg or some spice from a foreign land? -- Faber in Fahrenheit 451 -- To unsubscribe, send mail to awesome-unsubscr...@naquadah.org. -- To unsubscribe, send mail to awesome-unsubscr...@naquadah.org.
Signals on spawned clients
Hello, I'm new on this list so I introduce myself here. I'm a brasilian student and have been using awesome since 2009. I waited patiently until the release of debian squeeze, so just now, after the upgrade from lenny, i could start scripting to adapt awesome to my needs. So, please allow me to begin troubling you (and hopefully contributing with what I can!). ;) *** I built a mailbar that shows me new mail from each of the mailboxes from each mail account. Each mailbox with new mail generates one button that spawns a terminal with mutt inside that specific mailbox. I would like to add a signal to the spawned client, so I can refresh the mailbar when leaving mutt, after having read emails. The awesome api doc[1] says that awful.util.spawn's return value is awesome.spawn. When print awesome.spawn's type, I get a function type. But when I set a variable with the result of the spawn function, i get 'nil' as its type. I would like to do something like this: client = awesome.util.spawn(terminal .. -e \mutt -y\) client:add_signal(unmanage, function(c) unmanage_client(c) end) On the mailing list archives, I found someone saying that the return value of spawn() should be the PID of the spawned process[2]. On another mail[3], someone attached a hack to keep track of spawned clients with tags, but it also uses the return value of spawn(). Any ideas? Thanks a lot! drebs. -- [1] https://awesome.naquadah.org/doc/api/modules/awful.util.html#spawn [2] http://www.mail-archive.com/awesome@naquadah.org/msg03170.html [3] http://www.mail-archive.com/awesome@naquadah.org/msg03586.html -- __o _`\,_ (*)/ (*) -- To unsubscribe, send mail to awesome-unsubscr...@naquadah.org.
Re: Signals on spawned clients
On 20.04.2011 13:18, drebs wrote: The awesome api doc[1] says that awful.util.spawn's return value is awesome.spawn. When print awesome.spawn's type, I get a function type. But when I set a variable with the result of the spawn function, i get 'nil' as its type. No idea what you are looking at, but since 3.4.8, awesome.spawn() returns the PID in case of success and a string with an error message in case of error. Before 3.4.8, it returns nil for success and a string for error messages. Also, just starting something doesn't mean that a new window appears. You could e.g. do awesome.spawn(sleep 10) without getting a new window. It's actually quite hard to map a spawn()-call to the resulting window. No idea if it works, but you could give this a try (assuming you get the pid from spawn()): pid = awesome.spawn(terminal .. -e \sleep 5\) client.add_signal(unmanage, function(c) if c.pid ~= pid then return end print(c, disappears!) end -- Do you know that books smell like nutmeg or some spice from a foreign land? -- Faber in Fahrenheit 451 -- To unsubscribe, send mail to awesome-unsubscr...@naquadah.org.