Turning off display
Is there a way to program the keys SHIFT CONTROL EJECT which will put the displays to sleep. Looks like EJECT isn't on the SF keyboard.
- Kitch Membery @Kitch2020-05-13 21:07:19.302Z
Hi Jonathan,
you could use a system command line like this;
sf.system.exec({ commandLine: 'pmset displaysleepnow', });
Rock on!
- JJonathan Grossman @Jonathan_Grossman
you rule! Thanks Kitch. Hope you're well.
Kitch Membery @Kitch2020-05-13 21:35:35.815Z
You too Jonathan!
- TIn reply toJonathan_Grossman⬆:Tom Mochiach @Tom_Mochiach
hi
it does not work for me
I'm on MacBook Pro 2022 with an external thunderbolt 27- RRob Byers @Rob_Byers
I am having the same result as Tom. MacBook Pro 2021 with external displays via USB C and Displayport (USB C).
@Kitch might you have any ideas?
Kitch Membery @Kitch2023-01-20 21:06:08.770Z
Hi @Rob_Byers,
Other than using this the following code.
sf.system.exec({ commandLine: 'pmset displaysleepnow', });
I'm unaware of a way to do this.
If I find a way I'll let you know. :-)
- In reply toRob_Byers⬆:
Kitch Membery @Kitch2023-01-20 21:32:11.294Z
You could also try adding the
force
tag to the code like this.sf.system.exec({ commandLine: 'pmset displaysleepnow force', });
From what I understand, the "force" option in the command
pmset displaysleepnow force
is used to put external monitors to sleep even if it is the primary display.By default, when you run the command
pmset displaysleepnow
, the command will only put secondary displays to sleep, leaving the primary display active. However, when you use theforce
option, the command will put the primary display to sleep as well.So if you have multiple monitors connected to your Mac it will turn off all of them.
I have not tested it though.
- RRob Byers @Rob_Byers
Thank you, Kitch, I will try this. Appreciate your help, as always.
- RRob Byers @Rob_Byers
Kitch, I just gave this a try to no avail. Upon running the script, there are no changes on-screen.
I'm running an Macbook Pro M1 Max in clamshell mode. I bet the clamshell mode is getting in the way!
Kitch Membery @Kitch2023-01-23 19:56:31.758Z
That's a shame. I'll let you know if I find an alternative method.