Matt Legend Gemmell Modesty is Lying

Mac OS X Cocoa and iPhone Development Services available at Instinctive Code.
Mac OS X Cocoa and iPhone Developer for hire

Other Pages

Categories

Posted
15 March 2005 @ 10pm

Categories
Pie Menus, Tech, University

Tags
, , , ,

Project Report

Both the 3rd and 4th year labs are uncharacteristically busy at almost 10 pm tonight as I write this. The reason is that this Thursday at 2 pm (1 pm for the 3rd years, including Lauren) is the final hand-in time for our projects.

The 3rd years work in a team of 4 or 5 people, and 4th years work alone (I detailed my own project previously), starting last October and finishing around 40 hours from now. Code freeze is (hopefully) long past, and all that remains is to finish writing the project disserations, burn CDs of source code, print out the disserations twice (one copy for your project supervisor, and another for the reader), and hand it all in on Thursday afternoon. Suffice to say that, for many people, the tension is really mounting.

And here I am, taking a break from my write-up to make a quick blog post. As always, I tend to get little ideas when I’m busy working on something entirely unrelated, and so tonight I request something which very likely already exists: in the same way that Salling Clicker can pause and resume iTunes playback depending on your proximity from the machine (when you’re carrying a Bluetooth-enabled phone, of course), I want something which will lock (i.e. trigger my screen-saver) or unlock (somehow without requiring me to type my extremely long password) when I go away from or come back to my PowerBook. Maybe Clicker already does that; I don’t really have time to check right now. Answers on a postcard.

Anyway, back to work.


5 Comments

Robert Daeley
15 March 2005 @ 10pm

Well, not quite what you mean perhaps, but you can set your screensaver to x number of minutes and then require a password to get back in once it has begun.

System Preferences > Security > Require password…


Neil
15 March 2005 @ 11pm

We discussed this earlier on MSN but I’ll reiterate for any interested parties…

VLC almost already supplies what you want. It comes with an AppleScript which will lock the screen, using the OSX screensaver, when you go out of range (using some funky left_proximity() based AppleScript shizzm). However the way it quits the screensaver when you reenter proximity doesn’t work with OSX 10.3. Basically what it does is run the following command in the shell “/bin/ps -axw | /usr/bin/grep -i ‘ScreenSaverEngine’ | /usr/bin/awk ‘{print $1;}’ | /usr/bin/xargs /bin/kill -9″ which just kills the screensaver. Seemingly the Screensaver runs as root since 10.3 so this is no longer possible.

So you could just enter your password manually… or you could store it as plaintext and change the AppleScript to put the password into the text field (but that’s BA-AD). I guess an alternative would be to use a screensaver not running as root.

Cheers,
Neil


Iain Simpson
16 March 2005 @ 12am

You could also shove that command in a shell script, and set it suid root. You’d then be able to kill the screensaver by calling the script.

It’s better than a plaintext password… :)


Kenny
16 March 2005 @ 7am

Howdy Matt,

I run a linux box at home, and wrote a little shell script to do that very thing. Don’t know how applicable it will be to a mac, but I thought I would post it anyway.

-.-

#!/bin/bash
#
# Script to DPMS Wake the monitor if bluetooth
# device is within range.
# Kenneth H Gillen

# Constantly monitor the airwaves
while true
do
# If device is found,
# xx:xx:xx:xx:xx:xx is the bluetooth
# device address….
if hcitool scan | grep xx:xx:xx:xx:xx:xx
then
# Alert the user,
echo “Waking up monitor; User’s near”
# and wake up the display
xscreensaver-command -deactivate
xset dpms force on
else
echo “Scanning”
fi
sleep 1
done


Jasmeet
16 March 2005 @ 9am

Tried bluephonelite? It has an option to stop the screen saver when you enter the range, and start it up when leave. Can’t say I’ve tested it with a password though.


Leave a Comment

Office Assistance GoogleX