Hello to you
Recently, I was faced with the need to lock the screen on a poppy. That I was able to google did not satisfy me for various reasons, I just wanted to block the screen by hot key. As it turned out, to add this opportunity to the most does not present any difficulties, and only 10 minutes of time.
So, let's begin. To add a lock, we need only the built-in
Automator system. You can easily find it through
Spotlight.Our screen lock application will work as a system service. Why create a project "Service"
After that we need to add actions of our program, we are interested in the action "Run Shell Script". You just need to drag it to the right field.
The script itself to lock the screen:
/System/Library/CoreServices/"Menu Extras"/User.menu/Contents/Resources/CGSession -suspend
You just need to copy it to the script input window, as shown below.
Actually, our program is ready, now you can check its work by launching from Automator and if everything is good then save it as a service (cmd + s, then enter the name of our service, for example, “LockScreen”)
Open the system settings, go to the keyboard section, services and find our service.
We assign the hot key that you like and everything.