Use unclutter to hide mouse cursor
This commit is contained in:
parent
23a3f6f5ca
commit
d4255d81d0
16
forward.py
16
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.geometry('{}x{}+{}+{}'.format(MOUSEHOLD_W, MOUSEHOLD_H, MOUSEHOLD_X - MOUSEHOLD_W//2, MOUSEHOLD_Y - MOUSEHOLD_H//2))
|
||||||
root.update()
|
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():
|
async def mousemove():
|
||||||
last_mousemove = time.time()
|
last_mousemove = time.time()
|
||||||
|
|
||||||
@ -95,6 +101,7 @@ async def keyboardinp():
|
|||||||
is_ctrl = True
|
is_ctrl = True
|
||||||
if button == '24' and is_ctrl: # Ctrl+Q
|
if button == '24' and is_ctrl: # Ctrl+Q
|
||||||
print('DISPLAY=:0 xdotool keyup 37') # Release Ctrl
|
print('DISPLAY=:0 xdotool keyup 37') # Release Ctrl
|
||||||
|
await p_unclutter.terminate()
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
return
|
return
|
||||||
|
|
||||||
@ -110,10 +117,9 @@ async def keyboardinp():
|
|||||||
print('DISPLAY=:0 xdotool keyup 0{}'.format(button))
|
print('DISPLAY=:0 xdotool keyup 0{}'.format(button))
|
||||||
|
|
||||||
async def main():
|
async def main():
|
||||||
tasks = []
|
asyncio.create_task(hide_cursor())
|
||||||
tasks.append(asyncio.create_task(mousemove()))
|
asyncio.create_task(mousemove())
|
||||||
tasks.append(asyncio.create_task(mouseinp()))
|
asyncio.create_task(mouseinp())
|
||||||
tasks.append(asyncio.create_task(keyboardinp()))
|
await asyncio.create_task(keyboardinp())
|
||||||
await asyncio.gather(*tasks)
|
|
||||||
|
|
||||||
asyncio.run(main())
|
asyncio.run(main())
|
||||||
|
Reference in New Issue
Block a user