donn / nudelta

Open source NuPhy Console alternative
GNU General Public License v3.0
503 stars 22 forks source link

Lock Macbook with a key #45

Closed andy-96 closed 1 year ago

andy-96 commented 1 year ago

Thanks a lot for making the effort and building this!

It would be amazing if one could use the button next to "del" as the "locking the machine" button. If you have any hints on how to solve that, I might be able to help out with implementation.

Cheers!

donn commented 1 year ago

Hey Andy-

Well, there are two approaches. The first is extremely simple: just map that button to ⌃⌘Q, which is the default Mac shortcut to lock the screen: image

The second approach is somehow finding a scancode (the piece of data that the keyboard sends to the computer when a key is pressed) that would trigger locking the screen- but unfortunately finding that would be difficult. The best way I've found to do so is to use a utility called evtest on Linux- but some scancodes behave differently on macOS, and lock keys haven't been on a keyboard in a while, since it's just a simple ⌘L on Windows (which is ridiculously intuitive and what I use on Linux as well :slightly_smiling_face: )