erickutcher / monitoroff

Turn off your monitor with a simple mouse click or keyboard shortcut.
https://erickutcher.github.io/#Monitor_Off
14 stars 2 forks source link

Customizing keybinding #4

Open maliayas opened 1 month ago

maliayas commented 1 month ago

IMHO Ctrl+Shift+F4 is likely to collide with other programs. Even Windows Explorer uses it (on Windows 7 at least). Could there be a way to define custom keybinding? Or define a harder default such as Ctrl+Alt+Shift+F4?

erickutcher commented 1 month ago

Does Windows 7 use it? I initially coded this on that system and never experienced any issues. I'll see what I can do. For now, middle clicking the icon is the best way to avoid any conflicts.

maliayas commented 1 month ago

Does Windows 7 use it?

Yes, on my system that keybinding focuses the cursor to the address bar of Windows Explorer and opens a dropdown box (as if the mouse clicked on the little triangle icon right to the address bar).

erickutcher commented 1 month ago

Give this one a try: Monitor_Off.zip

To get the custom keys working you'll need to create a shortcut and then add some parameters to the end of the "Target" box in the Shortcut properties. It can accept at most 4 virtual key codes and they have to be in hexadecimal format. Here's a list of valid codes: https://learn.microsoft.com/en-us/windows/win32/inputdev/virtual-key-codes

As an example if you wanted to use Ctrl+Alt+Shift+F4 then you'll have a Target as follows:

"C:\Monitor_Off.exe" 0x11 0x12 0x10 0x73

Not all combinations work and the last value has to be the last key that's pressed.

maliayas commented 1 month ago

It's working perfect! Thanks a lot for the implementation.