GNOME Bugzilla – Bug 310001
click on notification raises terminal window
Last modified: 2012-05-27 19:16:08 UTC
The following patch makes clicking on the notification icon raise the terminal window. My use case is the following: jhbuild uses zenity to show a nifty notification icon, when I see an error in the notification I click it and the right terminal is popped up. I think it is really useful. I made this behavior unconditional[1], but you may decide to instead add a command line switch if it is not always desired. Alternatively, you may also decide that I'm on crack :) [1]: well, to more precise conditional on --listen, when we don't listen clicking causes exit like it is now.
Created attachment 48943 [details] [review] patch
Paolo, this is a cool feature, but it seems to be too much specific to jhbuild stuff. Could you give me more use cases?
Yep, I know that the behavior may not be wanted by all the users of `zenity --notification --listen'... Not sure about more use cases, I never used zenity notification support except for jhbuild :( I guess there are other scripts which want to do something similar (raise the terminal in which the script is executed), but you know zenity user way better than I do.
Would it instead be more generic to simply have a flag you could pass that would give you the XID of the terminal it was spawned from (as appropriate). You could then listen to the click event as you do now, and then do the XID focusing yourself (or something else exciting, as appropriate).
Actually, I use "zenity --notification --listen" in a some code, and I've already modified the paolo's code to do what I want. It would be neat to have the onclick behaviour customizable through a switch, instead of recompiling the code.
I'm not too fond of this patch. It would be better to have the code to raise the terminal be a separate program. Then zenity needn't be tied to any one behavior. I'll attach a patch that I'm playing with. It lets "zenity --listen" print a (user-settable) message on stdout in response to a click. It also lets the user specify a menu, where each item prints some message to stdout.
Created attachment 81337 [details] [review] patch to make zenity --listen handle right/left clicks
Created attachment 81348 [details] [review] patch to make zenity --listen handle right/left clicks Here's an updated version which uses gtk_status_icon_position_menu and which adds a "blink" command.
Why not allow zenity to call anything you want from the command line when an icon is clicked on? Heck you could do it in about 5 lines of code I bet. Just add a --command switch like this: zenity --notification --command "/usr/bin/gnome-terminal"
Will this strongly necessary long-pass coded behaviour ever be available in binaries ???
Hi, i put some ideas here: http://bugzilla.gnome.org/show_bug.cgi?id=507924 I think may be useful...
*** Bug 507924 has been marked as a duplicate of this bug. ***
Why the Tromey's patch was not commented? This was accepted? I'm not a C programmer, but i think i understand the code and it may be very good.
Sorry for the late response but i found this use case too specific. I mean i agree with adding an option to raise a command. But yes the bug makes sense. Something like this should be enough... "zenity --notification --listen --cmd=gnome-terminal"
(In reply to comment #13) > Why the Tromey's patch was not commented? This was accepted? I'm not a C > programmer, but i think i understand the code and it may be very good. I've just compiled Zenity with Tromey's patch and it just works. It has been here for 3 years so I wonder why it's not upstream :/
Hi, i just think this is a too specific case i wonder if most of the people will actually use it. The best option is to add an option to raise a command. Want to update the patch ? :)
(In reply to comment #16) > Hi, i just think this is a too specific case i wonder if most of the people > will actually use it. The best option is to add an option to raise a command. > > Want to update the patch ? :) Unfortunatelly I have absolutely no skills in C :P Just a little bit of bash and php ;) I will look in to the code but I can't promise I do anything with it ;) BTW I wonder what do you mean by "specific case". Zenity will output "string" on stdout when echoed "click:string" while in listen mode. So the script just needs to grab it and do whatever it's supposed to do when the 'string' shows up. IMO it's a very versatile solution and give's you an ability to change the click behaviour of already running zenity instance. Actually that's exactly what it should be (IMHO). The commmand line option --cmd=somecommand would be nice addition but too restricted for writing more complex scripts.
Is this still necessary? Since the notification system change a lot in gnome 3. I'm closing this bug. Feel free to reopen if you think it's still necessary.
Yes, I think that such functionality is still very necessary, and actually filed two bugs separate bugs, trying to clear up the issues with --notification. Bug 675068 Bug 675064