FoobarBucket
  • Home
  • Projects

tips

Homebrew lock screen hotkeys for OS X

Posted on January 30, 2015 Leave a Comment

Over the last several days a couple people have got Macs in our office, and have been requesting Windows-like screen locking feature. On Windows pressing the windows key and L will lock your screen. For years I never really knew about this feature until some Windows user colleges of mine mentioned it. I noticed It came in handy for them so I home brewed a solution for this on OS X. To gain Hotkey based screen locking:

  1. Open Automator in the applications folder.

  2. Create a new workflow, File > New ( or ⌘N )

  3. In the new workflow dialog, select “Service” and hit “Choose”. 

  4. Select Service receives: “No Input” in “Any Application”. 

  5. Here is where you can do a couple of different things:

    • If you want to have your mac lock via the screen saver, drag the “Start Screen Saver” option into the workflow. (You’ll have have to have your Mac lock on screen saver start. To do this, click on “Security & Privacy” in System Preferences and go to the “General” tab.)

    • If you want your screen lock to be independent of your screen saver, drag the “Run Shell Script” action into your workflow instead. Use the /bin/bash shell. Type the following into text field:

              /System/Library/CoreServices/Menu\ Extras/User.menu/Contents/Resources/CGSession -suspend
  6. Save the workflow. Name it something you’ll remember, like “Lock Screen”.

  7. Open System Preferences, got to Keyboard and the Shortcuts tab. Under the “Services” shortcuts your new service should appear under “General”. 

  8. Click add shortcut, and add press the modifier and standard keys you desire to invoke a lock. I use (and recommend) ⌘⌥⌃⇧L (That’s Command+Option+Control+Shift+L). The reason I have such a cumbersome option is to ensure that the global shortcut for screen lock isn’t used by an existing application shortcut. In fact, I used that combination without shift for many years until I ran into a collision.

Posted in: Uncategorized | Tagged: tips

Copyright © 2025 FoobarBucket.

Theme by ThemeHall.