I'm trying to configure devilspie so that on detection of opening a certain directory it runs a script to mount that directory over a network.
I don't think the script itself is too important but just in case I'll display its code here:
#!/bin/bash ldir=/home/LinPC/Desktop/Pictures rdir="//WinPC/My Pictures" if [ !"$(ls -A $ldir)" ] ; then sudo mount.cifs "$rdir" "$ldir" -o user=someguy fi
The script works when ran from a shell.
I configure devilspie using gdevilspie interface (which may be a part of the problem?). I know the conditions are being met as I see a window flash briefly but the shell instantly closes. I use the following line for the 'spawn_sync' action:
lxterminal -e sudo bash ~/mount_music.sh
Typing the above into a shell also spawns the shell and runs the script successfully (prompting me for input). Triggered by devilspie it does not prompt me, it opens and closes before I get to see the output.
(On a side note, entering into gdevilspie spawn_sync action:
lxterminal -command="sudo bash ~/mount_music.sh"
then closing the dialog and reopening it, causes everything after the equals symbol to have been wiped out; a bug in gdevilspie?)