Auto-lock your Mac, and pause your music when you leave your desk.

Auto-lock your Mac, and pause your music when you leave your desk.

I’m horrible at locking my workstation at work, and I work in an environment of practical jokers who love to play games with unattented workstations.

My solution? EventScrips and a bit of AppleScripting. The event we are going to watch for is a bluetooth device leaving the area.

I’ve configured the scripts to work with ether Radium or iTunes. whichever is running will get pause and play commands.

Here is the setup:

EventScripts

And here are the AppleScripts, The Last one DisableScreensaverPassword is optional I dont like entering my password every time the screensaver is activated. and when my applescript enables the screensaver it sets the passwrod to wake to true first. So when I’m away a password is required to disable to screensaver. I tried disabling the password and screensaver when the bluetoothe device is recognized again but it turns out OS X gets a bit cranky when you try and adjust security settings while the screensaver is activated.

Lock&Pause:

tell application "System Events"
    tell security preferences
        set require password to wake to true
    end tell
end tell

delay 1

if application "Radium" is running then
    tell application "Radium" to pause
end if

if application "iTunes" is running then
    tell application "iTunes" to pause
end if

Play:

if application "Radium" is running then
    tell application "Radium" to play
end if

if application "iTunes" is running then
    tell application "iTunes" to play
end if

DisableScreensaverPassword

tell application "System Events"
    tell security preferences
        set require password to wake to false
    end tell
end tell
No tips yet.
Be the first to tip!

Like this post? Tip with bitcoin!

1PAb9s4iJcTv89MppCfmrknca5d4EcCzKR

If you enjoyed reading this post, please consider tipping me using Bitcoin. Each post gets its own unique Bitcoin address so by tipping you're not only making my continued efforts possible but telling me what you liked.

Add Spaces to the Dock in OS X

With Spaces
Just quick useful post for separating out your doc items. I’ve had a few coworkers ask how I was able to break the icons in my dock into groups. You can achieve this by entering the following into Terminal.app (or iTerm.app)

defaults write com.apple.dock persistent-apps -array-add '{"tile-type"="spacer-tile";}'

Enter the following for however many breaks you want to add, Dont worry they are easy to remove by dragging off the Dock just like any other icon. You won’t see the changes right away and will need kill the Dock before you’ll see the changes, OS X will detect the Dock is no longer running and automatically relaunch it with the new settings. Now simply drag the spaces wherever you want them.

killall Dock

No tips yet.
Be the first to tip!

Like this post? Tip with bitcoin!

1CSUWjpiGEtwFDbWqXeekujbdDj8Xj2Snd

If you enjoyed reading this post, please consider tipping me using Bitcoin. Each post gets its own unique Bitcoin address so by tipping you're not only making my continued efforts possible but telling me what you liked.