#!/usr/bin/X11/wafe --f
# script to mount floppy drive

set driveA /dev/fd0
set mountA /a

mergeResources topLevel \
  *background lightSteelBlue \
  *Command.sensitive false \
  *font "-b&h-lucida-bold-r-*-*-12-*-*-*-p-*-iso8859-*"

form f topLevel
  command mount f \
     label "Mount $mountA" \
     callback {execute "/etc/mount -t msdos $driveA $mountA" mount unmount} 
  command unmount f \
     label "UnMount $mountA" \
     callback {execute "/etc/umount $mountA" unmount mount} \
     fromVert mount

realize

if [string match *$driveA* [exec /bin/mount]] {
  sV unmount sensitive true} else {
  sV mount sensitive true}

proc execute {cmd this other} {
  if [catch "exec $cmd"] { bell topLevel 1 } else {
    sV $this sensitive false; sV $other sensitive true } 
}

action f override "<Key>q: exec(quit)"

