fix: anti-idle uses mouse click instead of shift key, interval 60s

This commit is contained in:
2026-05-04 08:41:40 +00:00
parent 204bb02011
commit 4dec5a09ce
+4 -4
View File
@@ -90,7 +90,7 @@ def _anti_idle_loop():
env = {**os.environ, "DISPLAY": DISPLAY} env = {**os.environ, "DISPLAY": DISPLAY}
toggle = False toggle = False
while True: while True:
time.sleep(30) time.sleep(60)
with _lock: with _lock:
active = _should_be_connected and _proc is not None and _proc.poll() is None active = _should_be_connected and _proc is not None and _proc.poll() is None
if not active: if not active:
@@ -102,17 +102,17 @@ def _anti_idle_loop():
) )
win_id = r.stdout.decode().strip().splitlines()[0] if r.stdout.strip() else "" win_id = r.stdout.decode().strip().splitlines()[0] if r.stdout.strip() else ""
if win_id: if win_id:
x, y = (960, 540) if toggle else (970, 550) x, y = (5, 5) if toggle else (6, 6)
subprocess.run( subprocess.run(
["xdotool", "mousemove", "--window", win_id, str(x), str(y)], ["xdotool", "mousemove", "--window", win_id, str(x), str(y)],
env=env, capture_output=True, timeout=5, env=env, capture_output=True, timeout=5,
) )
subprocess.run( subprocess.run(
["xdotool", "key", "--window", win_id, "--clearmodifiers", "shift"], ["xdotool", "click", "--window", win_id, "1"],
env=env, capture_output=True, timeout=5, env=env, capture_output=True, timeout=5,
) )
toggle = not toggle 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: else:
log.debug("anti_idle: xfreerdp window not found") log.debug("anti_idle: xfreerdp window not found")
except Exception as e: except Exception as e: