0

I have some medical problems with my haands, I have been to the doctor for this, and he says I need to type less. To help with this I created an application in python which notifies me if I type too much, the problem is that I can still go over the limit, and without noticing I sometimes go over the limit a lot. Therefore, I want to block all keyboard input when I type too much.

I found this thread: disable or lock mouse and keyboard in Python?. But as far as I can tell all of these awnsers only work on windows (at least, I haven't been able to get any of them to work on linux).

So my question is: how do I disable the keyboard through python on a linux system?

1 Answer 1

1

you can use os.system(com) to run terminal commands. Then use xinput to disable your keyboard(look at this answer for more information). good luck!

Sign up to request clarification or add additional context in comments.

1 Comment

I was kinda hoping for a more native python solution. Though this would work as well I guess. Though I'd disable using: xinput float "MfgName Keyboard" and enable using reattach "MfgName Keyboard" 3. To avoid having to parse xinput list (devices changing id's seems to happen quite often). Though not sure if that 3 is static or if I still need to parse xinput list for that? Though I guess maybe really unlikely to change even if not technically static?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.