GNOME Bugzilla – Bug 448946
zenity widgets steal focus
Last modified: 2009-08-06 15:45:43 UTC
Please describe the problem: As per the metacity folks and the long, long issue of focus stealing, zenity needs to co-operate with the window manager to not steal focus from other applications when it pops up a dialog. Steps to reproduce: 1. Simply write a small script to pop up a dialog and watch it steal focus 100% of the time. Actual results: Expected results: As per the metacity team, a properly behaving application should not steal focus. Does this happen every time? Yes. Other information: I can dig up the references from the metacity team but at this point I will just assume that y'all understand these issues. Please advise if you need further information.
I don't really know the issues, but I do see this behavior. Something is odd though since the only references I see to the focus are in progress.c, but I see the behavior for any type of popup. So perhaps one of us is misreading -- either the behavior or the code.
It's sad to see that this bug, posted originally 10 months ago has not even been triaged. Is <zenity-maint@gnome.bugs> a blackhole?
I don't know about that. I do know that there are a number of reasonable patches sitting in bugzilla, some for a long time. I don't know Gnome protocol in this area any more. How would I go about getting them into svn?
Hi all, my fault! I've been busy with other stuff and ended up putting zenity with lower priority than normal. Will try to review and commit what makes sense this week. Thanks for the pings anyway. :-)
Hey, I have a fix for that but there's a side effect which I'm not is what we expect from a tool like zenity... If I make zenity not steal the focus, it won't popup in front the terminal window, for example (with metacity) - because the terminal owns the focus at the moment zenity runs. This can be really annoying for testing scripts using zenity for example.
I think one aspect of the problem is that the people who object to Zenity stealing focus are using the wrong tool for their immediate purpose. What is needed in many cases is an on-top, unfocused alert from libnotify. This is supposed to be implemented in Zenity, but I, personally, can't make it work for scripts at the moment. Luckily, there is a command-line interface to libnotify, notify-send, that is an excellent compliment to Zenity. Install libnotify-bin and test notify-send with: notify-send --icon=gtk-dialog-info --urgency=low --expire-time=5000 "Helpful message" I was dismayed when the new version of Zenity started opening windows in the background, but I found a patch here - https://bugs.launchpad.net/ubuntu/+source/zenity/+bug/272083 - that brings them back to the front. Conceptually, to me, Zenity is not really a separate program, so I definitely want the windows opening on top. For instance, I use Zenity extensively with Nautilus scripts, so, on those occasions, I think of Zenity as part of Nautilus, and want and expect Zenity windows to take focus when invoked.
Hrm. Yes. There appears to be two different issues at play here. Focus stealing (i.e. i'm typing my password into an application and zenity pops up a window, steals focus and my password starts to get entered into the zenity pop-up) and proper notification of a new window. I'm not sure how to separate them, but they are separate.
a patch was submitted to the ubuntu report: http://launchpadlibrarian.net/18653141/zenity-2.24.0-focus.patch May someone have a look to it and see if it makes sense? Lucas? ;-)
This patch essentially reverts http://svn.gnome.org/viewvc/zenity?view=revision&revision=1364
Lalalala, ping? The patch looks good to me.
Patch doesn't apply anymore because we moved out from glade files. I created a new patch locally. The patch does the exact opposite of what the bug report is requesting :-P Currently, zenity is *not* stealing focus. After some thought, considering we have no way to deal with window stacking without messing with focus in zenity, my impression is that for a tool like zenity (most likely to be used as an utility inside apps than an app per se) it's just annoying to not steal focus by default. An option to explicitly disable that is requested in bug 587353 which kind of makes sense to me... For non-intrusive notifications, people should probably be using notifications (zenity --notification --listen, etc). Closing this one as WONTFIX.
Bug 561131 is the one that was marked as fixed btw.