Adding graphic elements to your scripts with Zenity and KDialog

Shell Click

© www.sxc.hu

© www.sxc.hu

Article from Issue 99/2009
Author(s):

Zenity and KDialog let you integrate your scripts with the native KDE or Gnome environment.

A full-blown GUI-based application is beautiful to behold, but a graphical interface is way more trouble to create than a simple shell script. If you like the simplicity of scripting, but you prefer a little more visual feedback, Zenity (for Gnome environments) and KDialog (for KDE) are a pair of tools you should know about. These handy helpers let you integrate graphic dialog boxes into your scripts.

Dialog boxes prompt users for input, display output, or just report progress on a process. Zenity and KDialog also output error messages and general status information in the form of visual feedback, and you'll never need to type pathnames painstakingly; instead, you can use a graphical file browser.

Zenity [1] is included by default with the Gnome desktop in openSUSE, Ubuntu, and several other distros. KDialog is often installed with the default KDE environment. If your distribution does not include these tools, install the kde4-dialog or zenity package to get started. If you write scripts for other people, the computers that run those scripts will also need Zenity or KDialog. It is a good idea to incorporate a test into your script that checks for the presence of Zenity or KDialog before invoking their commands.

[...]

Use Express-Checkout link below to read the full article (PDF).

Buy this article as PDF

Express-Checkout as PDF
Price $2.95
(incl. VAT)

Buy Linux Magazine

SINGLE ISSUES
 
SUBSCRIPTIONS
 
TABLET & SMARTPHONE APPS
Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

  • Script Dialogs

    Starting a script on a Linux server with just a few mouse clicks sounds more complicated than it really is. If you want to create attractive and interactive dialogs for your desktop users, all you need is a small utility called SSH and a little Bash know-how.

  • Zenity Dialogs

    The Zenity command-line utility lets you create simple dialog boxes with your own data or with the output of utilities and applications.

  • Dress Up Bash Scripts with YAD
  • Workspace: Text Expander

    A couple of utilities and a dash of Bash scripting are all you need to roll out a simple yet flexible text expander.

  • Xonsh

    Create lightweight Raspberry Pi scripts with Xonsh, a Python shell that lets you write scripts in Python with Bash commands mixed in.

comments powered by Disqus
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters

Support Our Work

Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.

Learn More

News