[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

sounding system bell in a shell script run from toolbar icon



hey all -

here's my question:

I use IceWm which i love.  You can write shell scripts and initiate
them via icons on the menu or toolbar... i wrote one to mount and
unmount my CD-Rom.  Part of this script is to echo a system bell when
the Drive is fully mounted/unmounted or a longer bell if the device is
busy etc...  It works great when executed from a terminal window or
xterm in X.  But when i execute it via the menu/toolbar icon it won't
sound the system bell ( i assume it has something to do with echo ) ...
so far the way i have found around this is to tell the icon to open an
xterm window 

#----cut from $HOME/.icewm/menu
#the first word "prog" means program ; CD is the title displayed ;
#mounter is the name internal to Icewm and the rest is what is executed

prog CD mounter xterm +ls -geom 5x3-0+0 -T '' -bg red -fg red -e
/home/slamson/bin/mounter

#prog CD mounter mounter

#----end of cut

the uncommented one opens the xterm and it functions fine - opening a
"small" xterm and echoing a bell... the commented one works great too,
but no system bell.

How can i get the system bell to sound - you'll note i also use xset b
to set duration etc at the bottom of the script - without opening a
window to run this simple script?


TIA - Shawn                   (script "mounter" follows)



#!/bin/sh
#shell program to mount / unmount cdrom drive
#shawn lamson 06/24/2002

set -x          #uncomment for testing

DEVICE=/dev/scd0
MOUNT_PT=/cdrom
STATUS=ON
ERROR='         ERROR: mount or remount manually'

#
#       this program could grep the fields of /etc/fstab to find
devices but doesnt
#       it assumes /cdrom as mount point and my current device
/dev/scd0
#

if  ! grep "$MOUNT_PT" /etc/fstab
then
        echo -e "Device $DEVICE is not set to mount in /etc/fstab\a"
        echo $ERROR
        exit 1
fi

if  grep "$DEVICE" /etc/mtab
then
        STATUS=ON
else
        STATUS=OFF
fi

if [ $STATUS = ON ]
then
        umount "$DEVICE" && cdcd open && echo -e "\a" && exit 0
#
#               this will fail if device is busy
#               should drop down to echo bell
#

elif [ $STATUS = OFF ]
then
        cdcd close
        mount /cdrom
        echo -e "\a"            #indicate CD is ready
        exit 0
else
        echo $ERROR
        echo "You may want to examine the output of #cat /etc/fstab"
        echo "and #cat /etc/mtab        for clues"
        exit 1
fi
#
#this bell will execute if all else fails - for example device $DEVICE
is busy
#
echo "is device:$DEVICE busy?"
xset b 100 700 1000             #set bell vol pitch duration
echo -e "\a"
xset b          #sets bell back to defaults
set +x          #uncomment for testing



=====
Shawn Lamson
Debian/GNU Linux Woody
Kernel 2.2.19pre17
XFree86 Version 4.1.0.1 / X Window System
Jesus Loves You!

__________________________________________________
Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup
http://fifaworldcup.yahoo.com


-- 
To UNSUBSCRIBE, email to debian-user-request@lists.debian.org 
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org



Reply to: