summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--README8
-rw-r--r--blueman_open99
2 files changed, 56 insertions, 51 deletions
diff --git a/README b/README
index e69de29..9d94d70 100644
--- a/README
+++ b/README
@@ -0,0 +1,8 @@
+This (small) project is a modified version of the script found at
+http://www.kde-apps.org/content/show.php/kde4+bluetooth+files+open?content=108869
+
+The goal is to fix it up to work seamlessly in Xfce inside Slackware
+and (hopefully) merge the changes back upstream.
+
+Robby Workman and Zarren Spry
+
diff --git a/blueman_open b/blueman_open
index fccf141..8ca9769 100644
--- a/blueman_open
+++ b/blueman_open
@@ -1,74 +1,71 @@
#!/bin/bash
-phone_addr=$1
-own_name=`basename $0`
-dir=/tmp/$phone_addr
+phone_addr=$1
+own_name=$(basename $0)
+dir=$(mktemp -d)/$phone_addr
+browser=${browser:-"xdg-open"}
mount_phone ()
{
-i=0
-LIMIT=5
-while [ "$i" -lt "$LIMIT" ]
-do
- echo -n "$i "
- logger -i -t $own_name "Perform $i try to mount phone $phone_addr to $dir using obexfs"
- logger -i -t $own_name "Execute: obexfs -b $phone_addr -B 10 $dir"
- out=`obexfs -b $phone_addr $dir 2>&1`
- logger -i -t $own_name "$out"
- mounts=`cat /proc/mounts |grep $dir|wc -l `
- logger -i -t $own_name "Found $mounts mounted $dir inside /proc/mounts"
-
- if [ $mounts -ne 0 ] ;then
- kdialog --passivepopup "Successfully mounted $phone_addr to $dir" 2
- logger -i -t $own_name "Open $dir inside konqueror"
- out=`konqueror $dir 2>&1`
- logger -i -t $own_name "$out"
- exit 0
- else
- logger -i -t $own_name "Failed to mount $phone_addr to $dir from the $i try"
+ i=0
+ LIMIT=5
+ while [ $i -lt $LIMIT ]
+ do
+ printf "$i "
+ logger -i -t $own_name "Perform $i try to mount phone $phone_addr to $dir using obexfs"
+ logger -i -t $own_name "Execute: obexfs -b $phone_addr -B 10 $dir"
+ out=$(obexfs -b $phone_addr $dir 2>&1)
+ logger -i -t $own_name "$out"
+ mounts=$(grep $dir /proc/mounts | wc -l)
+ logger -i -t $own_name "Found $mounts mounted $dir inside /proc/mounts"
+
+ if [ $mounts -ne 0 ] ;then
+ kdialog --passivepopup "Successfully mounted $phone_addr to $dir" 2
+ logger -i -t $own_name "Open $dir with $browser"
+ out=$($browser $dir 2>&1)
+ logger -i -t $own_name "$out"
+ exit 0
+ else
+ logger -i -t $own_name "Failed to mount $phone_addr to $dir from the $i try"
+ fi
+ sleep1
+ ((i += 1))
+ done
+ if [ $mounts -eq 0 ] ;then
+ kdialog --passivepopup "Failed to mount $phone_addr to $dir.\nCheck /var/log/messages for errors." 4
fi
- sleep1
- ((i += 1))
-done
-if [ $mounts -eq 0 ] ;then
-kdialog --passivepopup "Failed to mount $phone_addr to $dir.\nChech /var/log/messages for errors" 4
-fi
-
}
umount_phone ()
{
-mounts=`cat /proc/mounts |grep $dir|wc -l `
-if [ $mounts -ne 0 ] ;then
-logger -i -t $own_name "Perform umount of $dir if it's already mounted"
-out=`fusermount -uz $dir 2>&1`
-logger -i -t $own_name "$out"
-mounts=`cat /proc/mounts |grep $dir|wc -l `
- if [ $mounts -eq 0 ] ;then
- logger -i -t $own_name "Successfully umounted $dir"
+ mounts=$(grep $dir /proc/mounts | wc -l)
+ if [ $mounts -ne 0 ] ;then
+ logger -i -t $own_name "Perform umount of $dir if it's already mounted."
+ out=$(fusermount -uz $dir 2>&1)
+ logger -i -t $own_name "$out"
+ mounts=$(cat /proc/mounts |grep $dir|wc -l)
+ if [ $mounts -eq 0 ] ;then
+ logger -i -t $own_name "Successfully unmounted $dir."
+ else
+ logger -i -t $own_name "$dir is already mounted. Failed to umount $dir.$out. Please perform its umount manually."
+ kdialog --passivepopup "Failed to umount $dir - check /var/log/messages for errors" 4
+ exit
+ fi
else
- logger -i -t $own_name "$dir is already mounted.Failed to umount $dir.$out.Please perform it's umount manually"
- kdialog --passivepopup "Failed to umount $dir.Chech /var/log/messages for errors" 4
- exit
+ logger -i -t $own_name "$dir is not mounted - no need to perform umount..."
fi
-else
-logger -i -t $own_name "$dir is not mounted.No need to perform umount"
-fi
}
create_dir ()
{
-logger -i -t $own_name "Create directory $dir to mount the phone by bluetooth"
-out=`mkdir -p $dir 2>&1`
-logger -i -t $own_name "$out"
+ logger -i -t $own_name "Create directory $dir to mount the phone by bluetooth..."
+ out=$(mkdir -p $dir 2>&1)
+ logger -i -t $own_name "$out"
}
-kdialog --passivepopup "Mount phone is in progress...Please wait" 4
+kdialog --passivepopup "Mount phone is in progress... Please wait..." 4
create_dir
umount_phone
mount_phone
-
-
-