After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 310001 - click on notification raises terminal window
click on notification raises terminal window
Status: RESOLVED WONTFIX
Product: zenity
Classification: Core
Component: general
unspecified
Other Linux
: Normal normal
: ---
Assigned To: Zenity Maintainers
Zenity Maintainers
: 507924 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2005-07-11 09:42 UTC by Paolo Borelli
Modified: 2012-05-27 19:16 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
patch (2.83 KB, patch)
2005-07-11 09:44 UTC, Paolo Borelli
none Details | Review
patch to make zenity --listen handle right/left clicks (5.40 KB, patch)
2007-01-28 00:37 UTC, Tom Tromey
none Details | Review
patch to make zenity --listen handle right/left clicks (5.44 KB, patch)
2007-01-28 04:14 UTC, Tom Tromey
none Details | Review

Description Paolo Borelli 2005-07-11 09:42:01 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.
Comment 1 Paolo Borelli 2005-07-11 09:44:14 UTC
Created attachment 48943 [details] [review]
patch
Comment 2 Lucas Rocha 2005-07-11 21:14:29 UTC
Paolo, this is a cool feature, but it seems to be too much specific to jhbuild
stuff. Could you give me more use cases?
Comment 3 Paolo Borelli 2005-07-12 09:17:33 UTC
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.
Comment 4 Danielle Madeley 2005-07-13 02:55:26 UTC
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).
Comment 5 Matt Rose 2005-07-27 14:53:16 UTC
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.
Comment 6 Tom Tromey 2007-01-28 00:33:30 UTC
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.
Comment 7 Tom Tromey 2007-01-28 00:37:21 UTC
Created attachment 81337 [details] [review]
patch to make zenity --listen handle right/left clicks
Comment 8 Tom Tromey 2007-01-28 04:14:20 UTC
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.
Comment 9 Bryan 2007-08-28 20:03:45 UTC
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"
Comment 10 Skippy le Grand Gourou 2008-01-18 21:56:28 UTC
Will this strongly necessary long-pass coded behaviour ever be available in binaries ???
Comment 11 Aurélio A. Heckert 2008-02-20 18:10:28 UTC
Hi, i put some ideas here:
http://bugzilla.gnome.org/show_bug.cgi?id=507924

I think may be useful...
Comment 12 Tom Tromey 2008-04-19 20:11:40 UTC
*** Bug 507924 has been marked as a duplicate of this bug. ***
Comment 13 Aurélio A. Heckert 2009-03-02 19:22:26 UTC
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.
Comment 14 Luis Medinas 2010-05-27 23:47:47 UTC
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"
Comment 15 Pawel Hadrian 2010-07-08 08:50:32 UTC
(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 :/
Comment 16 Luis Medinas 2010-07-08 09:42:06 UTC
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 ? :)
Comment 17 Pawel Hadrian 2010-07-08 10:13:41 UTC
(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.
Comment 18 Arx Cruz 2012-04-19 15:01:38 UTC
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.
Comment 19 Mic 2012-05-27 19:16:08 UTC
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