The Cookie Machine - Click here to drag window

DUMMY TEXT - Real text set in assets/js/theCookieMachine.js

Views: 2,278     Votes:  3     ✅ Solution
Tags: command-line   bash   redirect   yad  
Link: 🔍 See Original Question on Ask Ubuntu 🔗

URL: https://askubuntu.com/q/1144080
Title: How do I suppress GtkDialog warnings in zenity and yad using Bash redirection in a script?
ID: /2019/05/17/How-do-I-suppress-GtkDialog-warnings-in-zenity-and-yad-using-Bash-redirection-in-a-script_
Created: May 17, 2019    Edited:  May 18, 2019
Upload: November 24, 2022    Layout:  post
TOC: false    Navigation:  false    Copy to clipboard:  false


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?

⇧ Why is this python script running in background consuming 100 % CPU? dkms failure because gcc version is newer than that used to compile kernel  ⇩