7

Is it possible to prevent OSX from turning off displays when on the lockscreen? I'll lock my MBP with 2 external monitors, leave for 2-3 minutes, and come back and the monitor will be off. It then takes a bit of time for them to all come back on. I've tried Caffeine but it only appears to work when unlocked.

2
  • 1
    What models are your external monitors?
    – Monomeeth
    Sep 30 '19 at 23:49
  • Dell SE27H & ASUS PB278 each connected through HDMI with a USB-C dongle. The MacBook screen also turns off so it seems not to be monitor related
    – nijave
    Oct 2 '19 at 13:20
2
+25

There is a free and open-source tool named KeepingYouAwake that can be used as per your requirements.

Having KeepingYouAwake activated will prevent the screen from turning off when lock screen mode is activated.

Download the latest version here.

or install it via cask:

brew cask install keepingyouawake.

This utility will not harm your Mac because it is based on an official command-line tool by Apple. BUT I cannot guarantee anything, so use this tool AT YOUR OWN RISK.

1
  • This didn't work for me either
    – nijave
    Oct 17 '19 at 17:52
1

Settings > Power Management has the options that puts the display to sleep after some time.

It has two independent settings to be used if connected to a power source or using battery only.

Tweak these settings as per your requirement.

3
  • 2
    These don't seem to apply to the lock/login screen. I have mine set to 1hr for both and the Mac still turns the display off minutes after locking (although it works correctly when leaving it unlocked)
    – nijave
    Sep 30 '19 at 18:28
  • Are you using any screen saver? Sep 30 '19 at 19:06
  • It's left at the default settings of starting after 20 minutes. It seems to work if I leave it unlocked but I've never seen it start on the lock screen
    – nijave
    Oct 2 '19 at 13:22
1

Open Terminal and run the following:

caffeinate &

This will keep your display on until caffeinate is killed (you can quit Terminal if you want).

To disable caffeinate, run this in Terminal:

killall caffeinate

Hope this does the trick for you

1

I dug through Console and found it appeared to be checking for preventIdleDisplaySleep boolean. Searching on Github I found HammerSpoon which has a module which can set this via lua scripting. I installed HammerSpoon and added this to ~/.hammerspoon/init.lua and it prevented the sleeping issues

require "hs.caffeinate"
require "hs.hotkey"

hs.caffeinate.set("displayIdle", true, false)
hs.caffeinate.set("systemIdle", true, false)
hs.caffeinate.set("system", true, false)

hs.hotkey.bind({"cmd"}, "l", function()
  hs.caffeinate.fastUserSwitch()
end)

(The hotkey bind to simulate Windows/Linux screen locking behavior)

https://github.com/Hammerspoon/hammerspoon

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .