diff --git a/forward.py b/forward.py index 1d259f4..226abb9 100755 --- a/forward.py +++ b/forward.py @@ -35,6 +35,12 @@ if MOUSEHOLD_W > 0: root.geometry('{}x{}+{}+{}'.format(MOUSEHOLD_W, MOUSEHOLD_H, MOUSEHOLD_X - MOUSEHOLD_W//2, MOUSEHOLD_Y - MOUSEHOLD_H//2)) root.update() +p_unclutter = None +async def hide_cursor(): + global p_unclutter + p_unclutter = await asyncio.create_subprocess_exec('unclutter', '--timeout', '0', '--jitter', '9999', '--ignore-buttons', '1,2,3,4,5') + #await p.wait() + async def mousemove(): last_mousemove = time.time() @@ -95,6 +101,7 @@ async def keyboardinp(): is_ctrl = True if button == '24' and is_ctrl: # Ctrl+Q print('DISPLAY=:0 xdotool keyup 37') # Release Ctrl + await p_unclutter.terminate() sys.exit(0) return @@ -110,10 +117,9 @@ async def keyboardinp(): print('DISPLAY=:0 xdotool keyup 0{}'.format(button)) async def main(): - tasks = [] - tasks.append(asyncio.create_task(mousemove())) - tasks.append(asyncio.create_task(mouseinp())) - tasks.append(asyncio.create_task(keyboardinp())) - await asyncio.gather(*tasks) + asyncio.create_task(hide_cursor()) + asyncio.create_task(mousemove()) + asyncio.create_task(mouseinp()) + await asyncio.create_task(keyboardinp()) asyncio.run(main())