12

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?

2
  • 2
    Win+L to lock the screen?
    – ejbytes
    Jun 8, 2016 at 7:12
  • Penteract Clock has a screensaver-clock that can be started by right-clicking on its icon in the systray but you could use it for any screensaver. It just launches the default screensaver. Know that starting a screensaver does not lock your device immediately by default. It takes around 5 seconds for that to happen.
    – User42
    Jul 9, 2021 at 15:26

9 Answers 9

3

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.

4
  • Agreed, screen savers are just renamed .exe to .scr files that you can actually run.
    – Overmind
    Jun 8, 2016 at 5:15
  • 3
    That won't lock the PC though. Or will it? Jun 8, 2016 at 6:08
  • Simple enough to check out following the link. I tried it, but as soon as you press Win, or any key, the screen saver disappears.
    – ejbytes
    Jun 8, 2016 at 7:05
  • @CharlesGoodwin Yup, you're right.. that does NOT lock the PC. I have a screensaver on right now, and when I activate it, it does NOT lock the screen, in fact, I see the task bar at the bottom....
    – Malachi
    Dec 12, 2016 at 16:49
2

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.

1
  • 1
    This doesn't look like it will lock the computer as well.
    – mbomb007
    Sep 12, 2019 at 16:46
1

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.

0

I offer the next solution: Create a .bat file with the next content:

for /f "tokens=3" %%a in ('reg query "hkey_current_user\control panel\desktop" /v scrnsave.exe') do start "" /wait /d "%%~dpa" "%%~nxa" /s
tsdiscon

And launch it when you want to lock the session.

Explanation.

I wanted to do smth described in the title, but didn't find a way to do it (I hope, yet). Therefore I decided to follow the way from the screensaver settings: to lock session as continuation of the screensaver.

The screensaver settings

The script takes a key value for the screensaver from the windows registry and use it to start a pre-configured screensaver. That's why it works only after configuring a screensaver in Windows. You can configure screensaver settings here (press Win+R, enter text below and press OK):

control.exe desk.cpl,screensaver,@screensaver

Also:

  1. You can reach the screensaver settings via GUI.

  2. You can use "rundll32 user32.dll,LockWorkStation" instead of "tsdiscon", but I prefer the second way.

  3. I have an idea to hide all windows before launching a screensaver to prevent reading information during switching to the lock screen.

  4. You can try to find 3rd party app =)

I wanted to find info how to do the same from cmd, but when I didn't find necessary information I decided to join information from the next resources:

Similar question on StackOverflow

Configure screensaver via cmd

and, of course, for /?, reg /? etc. =)

0

Combination with EasyVideoScreensaver doesn't work with invoking .scr file. So my method uses AutoHotKey interpreter with such script:

sc045::                                                 ; the pause/brake key on keyboard (change sc045 to #L for Win+L)
    Sleep, 300                                          ; delay to prevent unintentional action stop
    SendMessage, 0x112, 0xF140, 0,, Program Manager     ; 0x112 is WM_SYSCOMMAND -- 0xF140 is SC_SCREENSAVE
Return

sc045 keyboard shortcut can be replaced to Win+L with #L

The screensaver has to have "On resume, display logon screen" enabled in screen saver configuration dialog. Also, it's worth pointing out that Screen saver grace period is set to 5 seconds by default (it's changeable in registry).

-2

Solution: Windows 7/8/10

Right-click on desktop, select New > Shortcut with Target set to:

C:\Windows\explorer.exe "C:\Windows\System32\Fliqlo.scr

(or some another screensaver, Fliqlo.scr is just example)

...you are welcome..

2
-2

It's an old question but I found a software that you can use and I'm using btw.

https://github.com/ukanth/monitores

Just activate "Auto SSaver On" and after you lock your PC SS turns on

->Software

Explanation & HowTo

https://www.howtogeek.com/146439/how-to-make-windows-start-the-screensaver-immediately-when-locked/

-3

This is definitely a hack and will require programming. It was an interesting idea and so I used keywords and found out for you.

OpenSource idea:
http://www.howtogeek.com/146439/how-to-make-windows-start-the-screensaver-immediately-when-locked/

Download this and install for your desired result.

0
-3
  1. Open text editor
  2. Paste this: control.exe desk.cpl,screensaver,@screensaver
  3. Save as batch file
  4. Copy batch file to desktop or wherever.
  5. Finish
1
  • This merely opens the Screen Saver Control Panel. We want to activate the screen saver as if the system had been idle for the timeout and, e.g., trigger the requirement that the user enter the password to access the computer (WITHOUT sleeping the display).
    – binki
    Mar 19, 2019 at 19:53

You must log in to answer this question.

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