fix: anti-idle uses mouse click instead of shift key, interval 60s
This commit is contained in:
@@ -90,7 +90,7 @@ def _anti_idle_loop():
|
||||
env = {**os.environ, "DISPLAY": DISPLAY}
|
||||
toggle = False
|
||||
while True:
|
||||
time.sleep(30)
|
||||
time.sleep(60)
|
||||
with _lock:
|
||||
active = _should_be_connected and _proc is not None and _proc.poll() is None
|
||||
if not active:
|
||||
@@ -102,17 +102,17 @@ def _anti_idle_loop():
|
||||
)
|
||||
win_id = r.stdout.decode().strip().splitlines()[0] if r.stdout.strip() else ""
|
||||
if win_id:
|
||||
x, y = (960, 540) if toggle else (970, 550)
|
||||
x, y = (5, 5) if toggle else (6, 6)
|
||||
subprocess.run(
|
||||
["xdotool", "mousemove", "--window", win_id, str(x), str(y)],
|
||||
env=env, capture_output=True, timeout=5,
|
||||
)
|
||||
subprocess.run(
|
||||
["xdotool", "key", "--window", win_id, "--clearmodifiers", "shift"],
|
||||
["xdotool", "click", "--window", win_id, "1"],
|
||||
env=env, capture_output=True, timeout=5,
|
||||
)
|
||||
toggle = not toggle
|
||||
log.debug("anti_idle jiggle window=%s pos=%s,%s", win_id, x, y)
|
||||
log.debug("anti_idle click window=%s pos=%s,%s", win_id, x, y)
|
||||
else:
|
||||
log.debug("anti_idle: xfreerdp window not found")
|
||||
except Exception as e:
|
||||
|
||||
Reference in New Issue
Block a user