Linked by Thom Holwerda on Fri 30th Jan 2009 17:57 UTC, submitted by fsmag
General Development "Whilst an increasing number of recent converts are avoiding it (and I don't blame them really), the shell is still a key tool for the majority of GNU/Linux users. Shell scripts are knocked-up, shared and deployed in all sorts of circumstances - some simply time-saving, others life-saving. But even if the shell script has been written by somebody else, running it can be a cumbersome and frightening exercise for users of lesser experience or confidence. How do we bring the flexibility of the shell script to the GUI-only user? Recently faced with just such a quandary, http://www.freesoftwaremagazine.com/columns/saving_my_sanity_zenity_shell_script_interaction_gui">I discovered Zenity: a tool which just might have saved my sanity."
Order by: Score:
1-line summary...
by Morph on Fri 30th Jan 2009 19:10 UTC
Morph
Member since:
2007-08-20

It's a tool to show simple dialog boxes from the terminal. These tools have been around forever. Big deal.

The author uses it to pop up a message when his network-connection script runs. Seems he just realised that there's a world of desktop users out there too. Taking care to make your programs (shell scripts or otherwise) user-friendly, interactive and informative isn't newsworthy. Indeed, it should be compulsory.

Reply Score: 5

RE: 1-line summary...
by mmebane on Fri 30th Jan 2009 20:22 UTC in reply to "1-line summary..."
mmebane Member since:
2005-07-06

Yeah. What is needed is something like the Windows AutoHotKey that can intelligently script Qt and GTK applications.

Reply Score: 2

RE: 1-line summary...
by alcibiades on Sun 1st Feb 2009 10:43 UTC in reply to "1-line summary..."
alcibiades Member since:
2005-10-12

Yes, what you say is true. But the problem is that to allow the user to work as he/she is used to may require quite a bit of work if you do it in any other way than zenity or kdialog.

Like, for instance, having him pick a date.

You can write a whole script and just use zenity to put up the user interactions with minimal work, and its all going to be very intuitive and normal for them.

Example at

http://www.linuxjournal.com/content/make-your-scripts-user-friendly...

What it means is, you can use shell scripts where otherwise you might be driven to a full blown gui language.

Reply Score: 2

Comment by flanque
by flanque on Fri 30th Jan 2009 19:22 UTC
flanque
Member since:
2005-12-15

I'm not sure you can convert the power of the shell to a GUI. A major selling point of the shell is piping commands together and I just cannot see how this'll be possible on the GUI.

Reply Score: 2

RE: Comment by flanque
by alcibiades on Sun 1st Feb 2009 11:05 UTC in reply to "Comment by flanque"
alcibiades Member since:
2005-10-12

Haven't actually done it, but it looks like the zenity commands to get the user input are just one line in the script. You can still pipe anything to anything in the rest of the script, and also can pipe that input.

Reply Score: 2

Avoiding the shell
by massysett on Fri 30th Jan 2009 19:33 UTC
massysett
Member since:
2007-12-04

"Whilst an increasing number of recent converts are avoiding it"

I often see glib statements about new Unix users avoiding the shell. What I have not seen is any basis for these statements.

Reply Score: 1

hmmm
by righard on Fri 30th Jan 2009 20:27 UTC
righard
Member since:
2007-12-26

From the article:
In my experience, users accustomed to a dialog with Yes/No buttons can find themselves stumped by a black window with a bunch of white text, the last line of which says something like Interface not found: proceed (Y/N)?.
I find myself stumped reading this.

Reply Score: 1

kdialog
by panzi on Fri 30th Jan 2009 21:49 UTC
panzi
Member since:
2006-01-22

For KDE users there is kdialog. It has everything zenity has minus calender but plus many other things: --geticon, --getopenurl, --menu, --combobox, --password, --checklist, --radiolist etc.
In combination with kfmclient (or kioclient for KDE4) this is really handy. I use it from python, too. e.g.: http://kde-apps.org/content/show.php/Get+YouTube+Video+(improved)?content=41456

Reply Score: 3

rklrkl
Member since:
2005-07-06

zenity (or kdialog or xdialog etc.) are all well and good, but your shell script should check for $DISPLAY and only run zenity if it's set. If it isn't set, each GUI dialog prompt/display will need the equivalent text-only prompts/output.

I'm about to do something similar myself with a text-only program I've written (in C - nothing wrong with system()'ing zenity from a binary - it's not just for shell scripts) - I'll be calling zenity for input and output, but only if $DISPLAY is set and /usr/bin/zenity is available (otherwise the old text input/output code will be used as a fallback).

Reply Score: 1

dialog
by pawnhearts on Sun 1st Feb 2009 06:26 UTC
pawnhearts
Member since:
2008-07-04

there are also "dialog" program for text terminals, and "gdialog" which use zenity but has same parameters as dialog.
so u can do something like on top of your script
[ "$DISPLAY" ] && DIALOG="gdialog" || DIALOG="dialog"

Reply Score: 1