Skip to content

Zenity: GUI for Your Scripts Easily

Introduction

I recently discovered with delight Zenity, developed by the Gnome team, which allows you to easily display GTK dialog boxes from shell scripts.

There is also dialog for ASCII GUI options.

Example of Restarting a Service

Here is an example to restart the openvpn service (openvpn-restart.sh):

1
2
3
4
zenity --question --text="Start OpenVPN ?" --ok-label="Yes" --cancel-label="No"
if [ $? = 0 ] ; then
    sudo /etc/init.d/openvpn restart
fi