I'm trying to suppress GtkDialog warnings in zenity and yad:
$ zenity --error --text hello
Gtk-Message: GtkDialog mapped without a transient parent. This is discouraged.
Error redirection and filtering works:
$ zenity --error --text hello 2> >(grep -v GtkDialog >&2)
YEAH... Annoying warning message disappears!!
This can be placed in ~/.bashrc for development work as answered here:
and here:
When creating a script for others to use though, you don't want the burden of them changing their ~/.bashrc.
I'm having trouble creating a typing shortcut for: 2> >(grep -v GtkDialog >&2) to be used inside script.
For many reasons variable assignment GTK_SPAM="2> >(grep -v GtkDialog >&2)" followed later by variable usage "$GTK_SPAM" doesn't work.
alias zenity="zenity 2> >(grep -v GtkDialog >&2)" before calling script works but, I can't use this within a script.
Using an array to hold the typing shortcut isn't working:
$ aGtkSpam=(2\> \>\(grep -v GtkDialog \>\&2\))
$ DumpArray "${aGtkSpam[@]}"
Array Elements:
0: 2>
1: >(grep
2: -v
3: GtkDialog
4: >&2)
$ zenity --error --text hello "${aGtkSpam[@]}"
This option is not available. Please see --help for all possible usages.
$ yad --text hello 2> >(grep -v GtkDialog >&2)
$ yad --text hello "${aGtkSpam[@]}"
Gtk-Message: GtkDialog mapped without a transient parent. This is discouraged.
I found many excellent generic answers on word-splitting and parameters which should solve my problem but a specific syntax eludes me.
Any clues?
exec? Something likeexec 2> >(grep -v GtkDialog >&2)– steeldriver May 17 '19 at 17:16#!/bin/bash? – WinEunuuchs2Unix May 17 '19 at 17:21yadandzenityplus other apps I image all at once. Please post an answer for me to accept. – WinEunuuchs2Unix May 17 '19 at 17:36yadis used in your script. – WinEunuuchs2Unix May 17 '19 at 19:33${aGtkSpam[@]}did not help but it was a good idea. Jarno pointed that out a couple of years ago on a different script and it worked then. See my comment below SteelDriver's answer for my more targeted solution that allows other GtkDialog errors to flow through. – WinEunuuchs2Unix May 17 '19 at 23:46