fix: restore anti-idle in manager.py, fix ENTRYPOINT quoting in Dockerfile

- manager.py: anti_idle_loop sends xdotool Shift to xfreerdp window every 30s
  while session is active; mousemove fallback if window not found
- Dockerfile: restore xdotool package; fix ENTRYPOINT JSON quoting lost in heredoc
This commit is contained in:
2026-05-01 11:16:53 +00:00
parent 58cb8b1035
commit 4ab49cd10f
2 changed files with 30 additions and 1 deletions
+29
View File
@@ -70,6 +70,35 @@ def _monitor_loop():
threading.Thread(target=_monitor_loop, daemon=True).start()
def _anti_idle_loop():
"""Send Shift key every 30s while xfreerdp is connected to prevent screen lock."""
while True:
time.sleep(30)
with _lock:
active = _should_be_connected and _proc is not None and _proc.poll() is None
if not active:
continue
try:
# Try to send Shift to xfreerdp window
result = subprocess.run(
["xdotool", "search", "--name", "FreeRDP", "key", "shift"],
env={**os.environ, "DISPLAY": DISPLAY},
capture_output=True, timeout=5,
)
if result.returncode != 0:
# Fallback: mousemove
subprocess.run(
["xdotool", "mousemove", "--sync", "960", "540"],
env={**os.environ, "DISPLAY": DISPLAY},
capture_output=True, timeout=5,
)
except Exception as e:
log.debug("anti_idle error: %s", e)
threading.Thread(target=_anti_idle_loop, daemon=True).start()
class Handler(BaseHTTPRequestHandler):