GNOME Bugzilla – Bug 339149
strict focus and currently active workspace
Last modified: 2006-12-04 20:17:02 UTC
Application window behaviour (especially focus and raise) should be consistent, regardless of whether an application is launched from a terminal, the menu, the panel, a desktop icon, or by pure will power. Everything else is just confusing and counterintuitive IMHO, and breaks proper scriptability, especially for applications like eg. zenity. Other information: Originally posted as http://bugzilla.gnome.org/show_bug.cgi?id=326159#c65, now reporting as new as requested in http://bugzilla.gnome.org/show_bug.cgi?id=326159#c66. BTW I'm running metacity-2.14.3 with focus_new_windows set to "smart", ie. the (supposedly) old (2.12) behaviour. --- BEGIN COPY/PASTE --- Let me explain: I use a dedicated workspace with several terminal windows for compiling stuff. I have a script that basically does the ./configure && make && make check thing, then pops up a zenity window when it's finished. I usually start the script, then switch to a different workspace to do some web browsing, e-mail stuff, whatever. Before that annoying strict-focus thing, the zenity window would pop up on whatever workspace was currently active, and remind me to go check the results of the build. Now, it always pops up on the workspace that it was started from, and I only ever see it if I happen to switch back to the compiling workspace to check the progress myself - which makes the whole thing pretty much pointless and useless. To reproduce: 1a. Hit Alt-F2, click "run in terminal", and run 'sleep 3; zenity --info --text test' 1b. Alternatively, start gnome-terminal, and run 'sleep 3; zenity --info --text test' 2. Switch to a different workspace 3. Wait 3 seconds 4. ... 5. Still nothing. :-( To see the difference, do: 1c. Hit Alt-F2, _don't_ click "run in terminal", and run 'sleep 3; zenity --info --text test' 2., 3. as above 4. Enjoy the zenity window popping up on whatever the currenty active workspace happens to be! :-) --- END COPY/PASTE --- I seem to have missed the huge discussions mentioned in http://bugzilla.gnome.org/show_bug.cgi?id=326159#c66 unfortunately, pointers would be appreciated. If the problem here is something else than the new strict-focus thing, as the am. comment suggests, I'd suggest to make it configurable as well.
Odd, I was totally unaware of any such change. I'll have to try to reproduce it when I get a chance and see if I can figure out why this happened.
Wow, this is interesting. Zenity has some interesting hacks to determine which gnome-terminal window it was launched from, figuring out its XID and then marking the resulting zenity window as a transient of that gnome-terminal. So, this is entirely zenity's "fault" (see zenity/src/util.c functions transient_get_xterm(), transient_get_xterm_toplevel(), and zenity_util_make_transient(), the last of which is always called from zenity_util_show_dialog()); however, looking at the code this _has_ to be deliberate and have some kind of reasoning so it looks like they intentionally chose the behavior you complain about. An interesting sidenote is that even _if_ you set focus_new_windows to strict the zenity window will still get focus when launched from a terminal due to being treated as a dialog of the terminal. I'm going to mark NOTABUG, but if you want to argue with the zenity developers, you can feel free to reopen and reassign.
Thanks for your analysis, Elijah. I'll do as you suggested and reopen the bug for zenity. To the zenity developers: When using zenity as a finishing notifiction tool for long-running processes, it doesn't make any sense to expect the user to check back every couple of minutes - this sort of defeats the purpose of such a tool, IMHO. :-) In this case, it would be nice to have a command line option available to override the default behaviour. Something like "--ignore-terminal" or "--standalone" would make zenity ignore the fact that it was launched from a terminal, and make it behave as if it was launched as a standalone application from the menu, desktop icon, Alt-F2 or whatever, ie. pop up its window on the currently active workspace.
Created attachment 64449 [details] [review] Make zenity ignore the launching terminal Quick patch attached - it adds a general option "--ignore-terminal", which simply skips zenity_util_make_transient(). I don't know if the patch is up to zenity's coding standards, but it Works Fine For Me[tm]. :-)
Thomas, I could not reproduce this with zenity 2.16.2. The dialog always pops up on the current workspace. Could you please try this version and see if you still have this problem?
Yup, you're right, seems to work fine with plain vanilla 2.16. I didn't even notice, because I also applied my patch to 2.16 and changed all my scripts to use "--ignore-terminal". :-) Thanks a lot, feel free to close this bug!