kbtogglr¶
Toggle keyboard on and off.
- kbtogglr.main() int [source]¶
Capture
slave
andmaster
keyboard IDs.Determine whether lock-file exists. Create cache directory and lock-file if it does not to signal to program that keyboard is off, otherwise assume that the keyboard is on.
If the keyboard is off then the lock should be acquired.
Toggle on:
Run
xinput
to reattach the keyboard IDs.Send notification to desktop indicating keyboard is enabled.
If the keyboard is on then the lock should not be acquired, either because the keyboard has been toggled on, or the system has been rebooted.
Toggle off:
Run
xinput
to detach theslave
ID.Send notification, including off image.