====== Wainting for samba mounts upon login to KDE ====== Since my employer introduced the policy of switching off office PCs during night hours I'm keeping my documents and other important stuff (most notably my KDE Desktop directory) on a remote samba share. When I arrive to the office in the morning it's useful to have KDE wait for the Desktop directory to be mounted, that in turn only happens after my PC obtains an address via DHCP. Often I was too quick to supply my login credentials so KDE panicked and scattered the contents of my home dir on my desktop instead the contents of the Desktop dir. I've placed the following small script to an executable file named ''.xsessionrc'' in my home directory. The script uses ''kdialog'' to display a progress meter that counts for 100 seconds or until my Desktop directory can be found. Then it disposes the progress bar dialog via the KDE DCOP service. #!/bin/bash dcopserver DCOPREF=`kdialog --progressbar "Waiting for samba mounts" --title "Waiting..."` DCOPCLIENT=`dcopclient "$DCOPREF"` DCOPOBJECT=`dcopobject "$DCOPREF"` dcop "$DCOPCLIENT" "$DCOPOBJECT" showCancelButton true dcop "$DCOPCLIENT" "$DCOPOBJECT" ignoreCancel true for i in `seq 1 100`; do dcop "$DCOPCLIENT" "$DCOPOBJECT" setProgress $i cancel=`dcop "$DCOPCLIENT" "$DCOPOBJECT" wasCancelled` if [ "$cancel" = "true" -o -d "/mnt/cifs/mcree/Desktop" ]; then dcop "$DCOPCLIENT" "$DCOPOBJECT" close exit fi sleep 1 done {{tag>util dcop kde samba kdialog mount bash}} ~~LINKBACK~~