My cat keeps walking over my keyboard.
Is it possible to lock the keyboard with a keyboard short cut but leave the screen running and all apps visible?
Ask Different is a question and answer site for power users of Apple hardware and software. It only takes a minute to sign up.Sign up to join this community
You can use KeyboardCleanTool (made by the developer of BetterTouchTool).
It opens the application window with a button you have to press in order to lock/unlock the keyboard.
Download it from BetterTouchTool.net
There's no way to turn off a keyboard via shortcut because you would have no way to turn it back on. The best method to achieve what you are looking for is to disconnect the keyboard.
To do that, you should use a USB with a "disconnect" or a "power switch" to turn it on/off like the Sabrent 4 Port Switch. I recommended this for a different question in which the user needed to "reset" the USB bus to redetect their device; this will work perfectly for you.
When you want to "lock" your keyboard, just turn off the port. Turning it back on will automatically reconnect it.
What about wireless?
Turn it off. When you turn it back on, it will automatically reconnect.