GTK dialog boxes from shell scripts

Well, Peter showed you how to do it in KDE, so now I'll show you how to make GTK dialogs using a little program called Zenity.

It runs in a similar manner to kdialog:

zenity --info --text="FOSSwire is Awesome."

zenity-fw-awesome.png

As you can see, it is fairly similar to KDialog in execution. The only main differences are the syntax of the command and the GTK backend. Zenity supports all sorts of GTK widgets, just as KDialog supports all sorts of Qt widgets.

Chances are, if you can make a dialog in KDialog, you can do the same with Zenity, and vice-versa. For a full list of options available for scripting, simply run:

zenity --help-all

Now you can make native-looking dialogs in any desktop environment!

Avatar for jacob Jacob Peddicord - http://jacob.peddicord.net/

Jacob is a web developer, student, and programmer from Ohio. He is a staff member at the Ubuntu Forums and is most likely a fanboy of the distribution. He loves to write in code and words, play video games, and rant about topics most would have abandoned long ago. Jacob uses GNOME and is never seen running stable software, much to the demise of his laptop.

Home » Articles »

Discussion: GTK dialog boxes from shell scripts

  1. el piggy es haarp (guest)

    # Posted on 15 April 2009 at 03:19 AM

    hello

    thanks so much for that tip. i made a user based cronjob to run everyday at a specific hour, to remind me to take my evening meds. i found the evolution mail notification system too easy to dismiss. i bet this will do much better. i really appreciate the help.

    thank you



  2. l.a. (guest)

    # Posted on 15 April 2009 at 03:20 AM

    again, thanks so much. just what i was looking for :)



Home » Articles » GTK dialog boxes from shell scripts