File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -9,18 +9,10 @@ def main():
99 device = uinput .Device ()
1010
1111 keys = uinput .KeyCapabilities (device )
12- keys .add (uinput .KEY_H )
1312 keys .add (uinput .KEY_E )
13+ keys .add (uinput .KEY_H )
1414 keys .add (uinput .KEY_L )
1515 keys .add (uinput .KEY_O )
16- keys .add (uinput .BTN_LEFT )
17- keys .add (uinput .BTN_RIGHT )
18- keys .add (uinput .BTN_MIDDLE )
19-
20- rel_axes = uinput .RelativeAxisCapabilities (device )
21- rel_axes .add (uinput .REL_X )
22- rel_axes .add (uinput .REL_Y )
23- rel_axes .add (uinput .REL_WHEEL )
2416
2517 device .activate ()
2618 time .sleep (1 )
@@ -31,10 +23,5 @@ def main():
3123 keys .click (uinput .KEY_L )
3224 keys .click (uinput .KEY_O )
3325
34- for i in range (20 ):
35- rel_axes .move_by (uinput .REL_X , 5 , False )
36- rel_axes .move_by (uinput .REL_Y , 5 )
37- time .sleep (0.01 )
38-
3926if __name__ == "__main__" :
4027 main ()
Original file line number Diff line number Diff line change 1+ #! /usr/bin/env python
2+ # -*- coding: utf-8 -*-
3+
4+ import time
5+
6+ import uinput
7+
8+ def main ():
9+ device = uinput .Device ()
10+
11+ btns = uinput .KeyCapabilities (device )
12+ btns .add (uinput .BTN_LEFT )
13+ btns .add (uinput .BTN_RIGHT )
14+ btns .add (uinput .BTN_MIDDLE )
15+
16+ rel_axes = uinput .RelativeAxisCapabilities (device )
17+ rel_axes .add (uinput .REL_X )
18+ rel_axes .add (uinput .REL_Y )
19+ rel_axes .add (uinput .REL_WHEEL )
20+
21+ device .activate ()
22+ time .sleep (1 )
23+
24+ for i in range (20 ):
25+ rel_axes .move_by (uinput .REL_X , 5 , False )
26+ rel_axes .move_by (uinput .REL_Y , 5 )
27+ time .sleep (0.01 )
28+
29+ btns .click (uinput .BTN_LEFT )
30+
31+ if __name__ == "__main__" :
32+ main ()
You can’t perform that action at this time.
0 commit comments