Created
July 18, 2025 23:22
-
-
Save ali1234/8b8e4d5de623250dbf5103d7a1bb0277 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from evdev import UInput, ecodes as e | |
import time | |
cap = { | |
# we have to have some buttons and X, Y otherwise | |
# xfce doesn't recognize it as a mouse | |
e.EV_KEY: [e.BTN_LEFT, e.BTN_RIGHT], | |
e.EV_REL: [e.REL_X, e.REL_Y, e.REL_WHEEL, e.REL_WHEEL_HI_RES], | |
} | |
ui = UInput(cap, name='example-device', version=0x3) | |
# how big is each hi res scroll event | |
distance = 5 | |
# the direction | |
direction = 1 | |
while True: | |
# ordinary scroll events | |
#ui.write(e.EV_REL, e.REL_WHEEL, direction) | |
#ui.syn() | |
for n in range(120): | |
ui.write(e.EV_REL, e.REL_WHEEL_HI_RES, direction*distance) | |
ui.syn() | |
time.sleep(0.02) | |
#direction = -direction | |
time.sleep(2) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment