How to turn screensaver on immediately after locking computer?

I am looking for a way to turn my screensaver on immediately, or turn off the screen, either when I lock the screen (WIN-L) or by clicking on something on the desktop.

I have located MonitorES as a possible solution, but it appears to be somewhat out of date and I am concerned it does not support Windows 10 particularly well as it hasn't been updated in some time. It also does not support my media player of choice (SMPlayer).

Any ideas/suggestions on how to do this via a Windows setting/shortcut or some other way?


The built-in screensavers should be in the %windir%\SysWOW64 folder (e.g. Mystify.scr, Ribbons.scr, scrnsave.scr). You could add a Windows shortcut that runs one of these files. You could also add a shortcut key.


Answer:

I have 2 different tools for this at https://gist.github.com/RichardBronosky/c61465ed897c2f10e9bf16704d1d9af9

To make this a legitimate SO answer, I'll include the simpler one:

#!/bin/bash
# From: https://gist.github.com/RichardBronosky/c61465ed897c2f10e9bf16704d1d9af9
# This works from both WSL/bash and powershell!

powershell.exe -command "& (Get-ItemProperty 'HKCU:Control Panel\Desktop').{SCRNSAVE.EXE}"

This will get the value of the [terribly named] SCRNSAVE.EXE property from the registry. That value just happens to be a complete path to a *.scr file, and therefore you can (and I do) tell powershell to run it as a command.

Notes/Opinion:

This is a pretty succinct demonstration of how powershell returns objects (complete with methods, accessors, etc.) rather than streams of text like bash.

Here, the Get-ItemProperty returns an object [of type: System.Management.Automation.PSCustomObject] that has many properties. We access a single property with the convenient dot notation. (I have to admit that even though I can write sed directly into a script without testing it at the CLI, this IS better.) There is a useful tool for exploring objects that is recommended by a Microsoft technet blogger. Unfortunately, installing it now requires the -AllowClobber option. (Learn more here.) A slightly less convenient [flat] alternative is Get-Member. (Just pipe output to it.)

Having a 1/4 century of bash experience, powershell is very strange, but also a bit refreshing to work with. Just think of it as shell scripting in a more pythonic environment and it's not terrible... except for those backslashes.


This opensource app adds hot corners, and you can set one of them with the Lock option. The website is minimalist but the app works fine on Windows 10 and with multiple monitors.

The last build lacks one feature, which is the ability to put the monitor to Sleep rather than locking. If you need that, you can compile the source yourself.