- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
> cat antilol.py
#!/usr/bin/env python
import evdev
device = evdev.InputDevice('/dev/input/event2')
three = [0, 0, 0]
for event in device.read_loop():
if event.type == evdev.ecodes.EV_KEY and event.value == 1:
# print(event.code, evdev.ecodes.KEY[event.code])
three = three[1:] + [event.code]
if three == [
evdev.ecodes.KEY_L,
evdev.ecodes.KEY_O,
evdev.ecodes.KEY_L
] or three == [
evdev.ecodes.KEY_K,
evdev.ecodes.KEY_J,
evdev.ecodes.KEY_K
]:
for i in range(0, 3):
device.write(evdev.ecodes.EV_KEY, evdev.ecodes.KEY_BACKSPACE, 1)
device.write(evdev.ecodes.EV_KEY, evdev.ecodes.KEY_BACKSPACE, 0)