dekuNukem / USB4VC

USB Keyboard/Mouse/Gamepads on Retro Computers!
MIT License
207 stars 13 forks source link

Implement keyboard-triggered shutdown #16

Open ssokolow opened 9 months ago

ssokolow commented 9 months ago

This is a draft PR because I wasn't sure how you'd want to make this configurable, so the hotkey is currently hard-coded and I'll want to revise that, but it currently assigns Ctrl+Win+Alt+ScrollLock (i.e. Control+Command+Option+F14) to shut down the USB4VC.

I chose that key combo for three reasons:

  1. Scroll Lock is quite possible the most unused key on the entire keyboard, with Mac OS just using F14 as something a user can assign their own meaning to and X11-based desktops not even mapping it to the modifier flag anymore, let alone in combination with modifiers being held down.

    (On modern Windows, I believe it's only significant use is as something KVM switches can listen for a double-tap on, and, in my experience, USB-based ones that offer that feature (i.e. not the $20 USB/VGA ones off eBay you're likely to buy for your retro stuff) do it by listening for requests to change the Scroll Lock LED, not presses on the key itself.)

  2. It uses three modifier keys, which makes it even more unlikely to collide with anything.

  3. It's easy to remember because it's almost identical to the Mac OS "fast shutdown" key combo (Control+Command+Option+Power or Control+Command+Option+Eject) and, for PC users, it's easy to remember because it's just "Use three fingers on your left hand to press the three modifier keys that are in a row, then tap Scroll Lock".

However, if anyone has a problem with it that I'm missing, I have no problem with a different default.