Advertising
Paste Description for bmxl
A bluetooth X locking tool for kde
- bmxl
- Tuesday, January 15th, 2008 at 7:03:21pm UTC
- #!/bin/bash
- # This script should work with a single mobile phone.
- # Possible BUG: i tried to make it so if you have 2 or more phones you can select the one you want from a gui menu.
- # Dont know if it will work with 2 or more phones. it works when only 1 phone is detected, "well it works for me"
- # having problems try chmod +s $(which l2ping)
- # if X keeps locking up.. you need to set suid-root on l2ping
- # CTRL +ALT +F2 :then rm -f /home/user/mobkey.pid to stop it..
- #set -x
- Pd="$HOME/mobkey.pid" ;
- title="bmxl a bluetooth looking tool";
- message0="bmxl has started. \nplease wait while hcitool is scaning for mobile phones, it may take over 10 seconds"
- message1="Bluetooth mobil X lock is already Running or it was uncleanly stopped.\n Do you want to stop it?"
- message2="Found no Mobile phones. check if bluetooth is turned on"
- message3="Do you want to disable bmxl ?"
- icon="--icon /usr/share/icons/crystalsvg/16x16/actions/encrypted.png "
- if [[ ! -f $Pd ]]
- then echo $PPID > $Pd ;
- kdialog --msgbox "$message0" --title "$title" $icon
- else kdialog --yesno "$message1" --title "$title"
- if [[ $? == 0 ]] ; then rm -f $Pd ; fi ;
- exit 0 ;
- fi ;
- MOBS=`hcitool scan`
- INFOMOB=`echo $MOBS | sed 's/Scanning ... /\n/g'`
- NROFMOB=`echo $MOBS | sed 's/Scanning ... /\n/g' | wc -l`
- ARRAY=""
- if [[ "${NROFMOB}" -lt "2" ]]
- then kdialog --sorry "$message2" --title "$title" $icon
- rm -f $Pd
- exit 0;
- fi
- for (( i = 1 ; i <= $NROFMOB ; i++ )) ; do
- NAMEMOB=`echo $INFOMOB | awk '{print $2}' | sed -n ""$i"p"`
- MACMOB=`echo $INFOMOB | awk '{print $1}' | sed -n ""$i"p"`
- ARRAY=`echo $ARRAY $MACMOB $NAMEMOB`
- done
- MOBMAC=`kdialog --menu "Select your mobile" $ARRAY --title "$title" $icon`
- if [[ $? == 1 ]]
- then rm -f $Pd
- exit 0;
- fi
- while :; do
- if [[ ! -f $Pd ]] ; then break ; fi
- l2ping -c1 -t1 -i hci0 $MOBMAC
- if [[ $? == 1 ]] ;
- then if [[ `dcop kdesktop KScreensaverIface isBlanked` == false ]]
- then `dcop kdesktop KScreensaverIface lock`
- #kdialog --yesno "$message3" --title "$title"
- #if [[ $? == 0 ]]
- #then rm -f $Pd
- # exit 0;
- #fi
- fi
- else if [[ `dcop kdesktop KScreensaverIface isBlanked` == true ]]
- then dcop kdesktop KScreensaverIface quit
- fi
- fi
- sleep 4;
- done
advertising
Update the Post
Either update this post and resubmit it with changes, or make a new post.
You may also comment on this post.
Please note that information posted here will not expire by default. If you do not want it to expire, please set the expiry time above. If it is set to expire, web search engines will not be allowed to index it prior to it expiring. Items that are not marked to expire will be indexable by search engines. Be careful with your passwords. All illegal activities will be reported and any information will be handed over to the authorities, so be good.