Hi all,
I hope this post is on the right place …
I have created a script which mounts over FvwmButton a device and change the icon if succeed. If an error occur while mounting it should open a xdialog message box but it doesn’t
I must go with ctrl-alt-F1 to a console and kill the Xdialog process cause it blocks all working in the windowmanager.
Here are my configs:
In the FVWM config file:[code]#########
Mount/unmount function
#########
DestroyFunc ToggleMount
AddToFunc ToggleMount
- I PipeRead ‘$[fvwm_script]/mount.sh $0 $1’
[/code]
The FVWMButton config:[code]:
Floppy anzeigen
###########
*FvwmMount: (3x8+1+0, ActionOnPress,
Id “F”,
Icon $[fvwm_icon]/32x32/devices/3floppy_unmount.png,
ActiveIcon $[fvwm_icon]/48x48/devices/3floppy_unmount.png,
Action(Mouse 1) ToggleMount “/floppy” “F”),
:[/code]
The mount.sh script:[code]#!/bin/sh
error=""
mounted=0
check if mounted
mounted=grep -c "$1" /etc/mtab
if [ $mounted -eq 0 ]
then
#mount device
mount $1 2>error.tmp
error=cat error.tmp
if [ -z “$error” ]
then
# change the correct icon
if [ $2 == “F” ]
then
FvwmCommand “SendToModule FvwmMount ChangeButton “$2” Icon /home/tf/.fvwm/img/icon/32x32/devices/3floppy_mount.png”
FvwmCommand “SendToModule FvwmMount ChangeButton “$2” ActiveIcon /home/tf/.fvwm/img/icon/48x48/devices/3floppy_mount.png”
fi
#if not ok print error message
else
Xdialog --title “Mount Error” --wmclass error --msgbox “$error” 0 0
fi
if mounted==0 then unmount device
else
umount $1 2>error.tmp
error=cat error.tmp
if unmount ok change icon
if [ -z “$error” ]
then
# if unmount ok change icon
# change the correct icon
if [ $2 == “F” ]
then
FvwmCommand “SendToModule FvwmMount ChangeButton “$2” Icon /home/tf/.fvwm/img/icon/32x32/devices/3floppy_unmount.png”
FvwmCommand “SendToModule FvwmMount ChangeButton “$2” ActiveIcon /home/tf/.fvwm/img/icon/48x48/devices/3floppy_unmount.png”
fi
if unmount fail print error message
else
Xdialog --title “Unmount Error” --wmclass error --msgbox “$error” 0 0
fi
fi
exit 0[/code]
If I takeecho error Mount: $error >> ~/.xsession-errors
all works fine.
Also, if I execute the script over a console window it works fine too and the xdialog message appears :?
What’s going wrong?
Please help, thanks.
Best Regards,
TF
edit: btw I get an error message in the xsession-errors if I restart FVWM:[FVWM][__execute_function]: <<ERROR>> No such command 'mounted:'
Why?