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?

TT-392
  • 43
  • 5

1 Answers1

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!

Ofir Siboni
  • 81
  • 1
  • 5
  • 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? – TT-392 Aug 30 '21 at 09:42