The Cookie Machine - Click here to drag window

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

Views: 5,695β€…    Votes:  6β€…
Tags: command-line   bash   gtk   redirect   zenity  
Link: πŸ” See Original Answer on Ask Ubuntu πŸ”—

URL: https://askubuntu.com/q/896936
Title: How to make zenity "transient parent" warning disappear permanently
ID: /2017/03/26/How-to-make-zenity-_transient-parent_-warning-disappear-permanently
Created: March 26, 2017    Edited:  June 12, 2020
Upload: November 24, 2022    Layout:  post
TOC: false    Navigation:  false    Copy to clipboard:  false


Automatically add 2>/dev/null every time zenity is called

Edit the file ~/.bashrc and search for these lines:

# some more ls aliases
alias ll='ls -alF'
alias la='ls -A'
alias l='ls -CF'

Add the following lines after:

# Add zenity alias to make the annoying terminal error message disappear forever:
# "Gtk-Message: GtkDialog mapped without a transient parent. This is discouraged."
alias zenity="zenity 2>/dev/null"

Save the file and open a new terminal window to test:

zenity --info --text "Hello Zenity-Silly-Error-Free World"

Voila! All your old code is fixed and future code doesn’t need to have 2>/dev/null appended to it like all the other answers instruct.

⇧ writing a text file in the terminal with touch How can I "diff" two files with Nautilus?  β‡©