Under ubuntu 16.04 I get the following message

 Gtk-Message: GtkDialog mapped without a transient parent. This is discouraged

when I open zenity with the command

  zenity --text-info --filename=<filename>

This didn't happen under 14.04. I presume that the answer is related to this post but the post doesn't explain how to implement the proposed solution. Could somebody please explain which file I should add the suggested lines to?

You fix this warning by giving the GtkDialog a parent to be modal to. The relevant functions are gtk_window_set_transient_for() (which sets this window to always be on top of, or transient for, another one) and optionally gtk_window_set_modal() to make it a modal dialog. This is ultimately what the various GtkDialog constructors do.

  • zenity --help-general gives --attach=WINDOW Set the parent window to attach to but I'm not sure how to use it (what is Window?), perhaps it will solve your problem. – Al.G. Dec 27 '16 at 10:55
  • Thanks, @Al.G. I was able to recover the WINDOW id with the line WINDOW_ID=$(xprop -name echo $TITLE` | grep WM_CLIENT_LEADER | cut -d"#" -f2 | cut -c2-20)` and I then tried zenity --attach=$WINDOW_ID --text-info --filename=<filename> but sadly I still got the warning. Too bad, but it may come in handy one day to know how to get the window id! – Leo Simon Dec 27 '16 at 17:16
  • Actually if you search the source of zenity for gtk_window_set_transient_for you'll get no results. – Al.G. Dec 27 '16 at 17:23
  • Yup. If you search for gtk_window_set_modal you get lots of results, but I don't know how to set it in a way that silences the message. – Leo Simon Dec 27 '16 at 21:07
  • 1
    According to the docs you give it a window and a parent window. I suppose it should be called somewhere after the window creation with parent window set to NULL. However I couldn't make install zenity locally (I couldn't find docs or something on how to configure install) so I finaly gave up. Will have to use the dirty 2>/dev/null. – Al.G. Dec 27 '16 at 22:19
up vote 14 down vote accepted

Ignore it.

It's a warning, not an error. The application works, it's just not coded with best practices in mind, as it seems. You would have to modify zenity's source code to implement the fix described in your linked question and then compile it yourself, but... it works anyway, so why should you bother?

If you just want to get rid of the output in your terminal, you could simply redirect STDERR (standard error stream, that's where the warning gets printed to) to /dev/null (virtual character device that swallows data) by appending 2> /dev/null to the end of the command, like this:

zenity --text-info --filename=<filename> 2> /dev/null
  • 1
    Thanks! Unfortunately for some reason 2> /dev/null doesn't have the desired effect, the warning still persists. I know it's only a nuisance, but I would love to be able to suppress warnings like this. – Leo Simon Nov 1 '16 at 20:11

zenity ... 2>/dev/null works for me. The only problem I see is that other (important) errors messages will also be suppressed so better build error capture somehow in your code

  • Indeed, this looks like a dangerous solution. Better not use it. – Marc Vanhoomissen Aug 14 at 8:40

Your Answer


By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.