Lock Mac After Inactivity
Published on 15 Mar 2019
by Guy Lewin
Mac comes with a shortcut for locking the desktop session - ⌘ + Ctrl + Q
. It is also possible to define another keyboard shortcut for that.
In my case, I wanted the screen to lock automatically after I’m idle for a certain period of time. That’s also easily configured by following these steps:
- Launch System Preferences -> Desktop & Screen Saver -> Screen Saver
- Change the “Start after:” value in the left bottom corner to the requested idle time (in my case - 1 minute).
- On System Preferences -> Security & Privacy -> General - mark “Require password immediately after sleep or screen saver begins”
This was a good solution, but my workplace setup a group policy (by enforcing a configuration profile) that sets the “Start after” time in the screen saver pane to 20 minutes, which is way too long for me.
To solve that, I wrote this small cron task that checks your inactivity time, and launches the screen saver manually if enough time has passed. You can find the code + installation instructions here.
all tags
airplay api apple music as3992 bank bidirectional bluetooth blueutil bose configuration profile controlplane crash credit card ctf debug dhcp dns exploit facebook finance grpc grpc-java home assistant hotspot hxp inactivity iodine ios ip iphone jq kernel lfi linux lldb lock mac macbook manual-screensaver-cron messenger nginx notifications oncompleted onerror pasten php pi-btaudio power manager python quietcomfort radxa rock pro raspberry pi raspotify rce reddit rfid rock pro rtl8187l screensaver sha-1 shairport-sync spotcast spotify ssh static statusruntimeexception stream streamobserver telegram ubiquiti ue boom unable to attach unifi unintended web webcore webkit wifi xcode