Muffinresearch Labs by Stuart Colville

mac tip: Lock screen and pause iTunes | 1 Comment

Posted in Apple, Code on 24th April 2008, 12:09 am by

In the past I’ve used a specific app that allowed configuration of a keystroke to lock my screen but in setting up a new machine I thought I really want to add the ability to pause iTunes as well as locking the screen. The locking part is caused by having the screen saver set up to lock the screen – this is set in security preferences. To make this all happen just requires the following noddy applescript.

try
	do shell script "killall -s iTunes"
	tell application "iTunes"
		pause
	end tell
end try
do shell script "open '/System/Library/Frameworks/ScreenSaver.framework/Resources/ScreenSaverEngine.app'"

To get the keystroke configured I’m using quicksilver triggers (to do this you’ll need quicksilver installed), first put the script above into script editor, save as an application bundle the the location of your choice and then point a trigger to that app file and define your keystroke. I also set the scope to all applications. Done!

Update: Added a dirty little try catch to only run the pause when iTunes is open

Post Tools

GNU screen: open tab in current working directory|(1)

A nice trick for having screen open a new tab in the same directory as the one you’re currently in. To use it add it to your .screenrc

# Open new window in current dir.
bind c stuff "screen -X chdir \$PWD;screen^M"
bind ^c stuff "screen -X chdir \$PWD;screen^M"

Hat tip: mteckert on SuperUser.com

Ubuntu: add-apt-repository: command not found|(3)

When you’re using a minimal Ubuntu install if you find the ‘add-apt-repository’ command is missing (it’s useful for adding PPAs and other repositories), then simply run:

sudo apt-get install python-software-properties

Photos on Flickr

© Copyright 2004-12 Stuart Colville, all rights reserved. May contain traces of Muffin. Powered by WordPress. Hosting by Slicehost.com This page was baked in 0.543s.