1

When I used Alfred's Lock command my mac locks and shows a screen with a password prompt. I want to know if I can do this on machines that don't have Alfred installed. Is there a way to do by perhaps creating an automator service?

grg
  • 201,078
Steve Moser
  • 8,734
  • You could log out... if you select the button the reopens the last windows you have open it will work. It's not pretty, though – NoahL Dec 21 '16 at 17:28
  • 1
    I do not use Alfred, so all I can offer is... you can use /System/Library/CoreServices/"Menu Extras"/User.menu/Contents/Resources/CGSession -suspend in a Run Shell Script action in an Automator Service and assign it a keyboard shortcut or use it in an AppleScript script from the AppleScript menu on the Apple menu bar or and AppleScript app or a bash script wrapped with Platypus, etc. Have a look at: How to lock your Mac screen with a keyboard shortcut – user3439894 Dec 21 '16 at 17:31

1 Answers1

1

You can create an Automator workflow with a Run Shell Script action containing:

/System/Library/CoreServices/Menu\ Extras/User.menu/Contents/Resources/CGSession -suspend
grg
  • 201,078
  • @user3439894 All Automator documents are workflows, a service is still a workflow; the question did not specify a keyboard shortcut had to be used. I did not see your comment likely because I had this question open prior to your comment and didn't load them before posting my answer. – grg Dec 21 '16 at 18:23