Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

Previously, in KDE, this was simple -- I called KDialog with number of steps, I got DCOP handle in return, then I called dcop with that reference and step, and progress dialog got updated.

However, now DCOP is obsolete, and since I moved from KDE 3.5.10 to XFCE, I thought it would be a good idea that instead converting my script from KDialog+DCOP to KDialog+DBUS I migrate to XFCE progress dialog.

So how do you build progress dialog for Bash purposes in XFCE? Bash purpose = I perform some computation in Bash, but the progress is shown in GUI way, as nice dialog on the desktop.

share|improve this question

1 Answer 1

up vote 2 down vote accepted

You can use dialog utility. It can works both inside and outside a terminal.

To get it on the X server, you may use its xdialog or gdialog/zenity variant. Take note that zenity is recommendend for XFCE, since its use GTK+. In fact, I think Kdialog is a KDE variant of Xdialog.

Here is a simple Zenity script, running on X server with a yes/no box :

DIALOG=zenity
$DIALOG --title " My first dialog" --clear \
--yesno "Hi, this is my first dialog" 10 30

Here's a simple tutorial with various example about the different dialog available. And there's also a nice tutorial about zenity.

About your graphical progress dialog, there's one dedicated for this purpose. Here's the sample script of the documentation :

#!/bin/sh
(
echo "10" ; sleep 1
echo "# Updating mail logs" ; sleep 1
echo "20" ; sleep 1
echo "# Resetting cron jobs" ; sleep 1
echo "50" ; sleep 1
echo "This line will just be ignored" ; sleep 1
echo "75" ; sleep 1
echo "# Rebooting system" ; sleep 1
echo "100" ; sleep 1
) |
zenity --progress \
  --title="Update System Logs" \
  --text="Scanning mail logs..." \
  --percentage=0

if [ "$?" = -1 ] ; then
        zenity --error \
          --text="Update canceled."
fi
share|improve this answer
    
Many thanks for such explanatory answer! –  greenoldman Mar 18 '12 at 13:12
    
If anyone is wondering how to mimic KDialog further and use zenity as monitor in the background here is how I did it -- unix.stackexchange.com/questions/38807/… –  greenoldman May 17 '12 at 10:43

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.