1
Fork 0

Use unclutter to hide mouse cursor

This commit is contained in:
RunasSudo 2019-11-21 23:45:49 +11:00
parent 23a3f6f5ca
commit d4255d81d0
Signed by: RunasSudo
GPG Key ID: 7234E476BF21C61A
1 changed files with 11 additions and 5 deletions

View File

@ -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())