KeyboardCleanTool is a free app that disables keyboard input so that you can clean your computer while avoiding unwanted key presses.

brew install --cask keyboardcleantool