fix: anti-idle uses xdotool --window; remove creds from URL
rdp-proxy/manager.py: anti_idle_loop gets window ID first, then sends key --window ID --clearmodifiers shift (was broken chain syntax). universal-runtime/manager.py: removed credentials from URL - they break SPA fetch() calls causing white screen (e.g. CGP).
This commit is contained in:
+14
-9
@@ -72,6 +72,7 @@ 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."""
|
||||
env = {**os.environ, "DISPLAY": DISPLAY}
|
||||
while True:
|
||||
time.sleep(30)
|
||||
with _lock:
|
||||
@@ -79,19 +80,23 @@ def _anti_idle_loop():
|
||||
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,
|
||||
r = subprocess.run(
|
||||
["xdotool", "search", "--name", "FreeRDP"],
|
||||
env=env, capture_output=True, timeout=5,
|
||||
)
|
||||
if result.returncode != 0:
|
||||
# Fallback: mousemove
|
||||
win_id = r.stdout.decode().strip().splitlines()[0] if r.stdout.strip() else ""
|
||||
if win_id:
|
||||
subprocess.run(
|
||||
["xdotool", "key", "--window", win_id, "--clearmodifiers", "shift"],
|
||||
env=env, capture_output=True, timeout=5,
|
||||
)
|
||||
log.debug("anti_idle shift sent window=%s", win_id)
|
||||
else:
|
||||
subprocess.run(
|
||||
["xdotool", "mousemove", "--sync", "960", "540"],
|
||||
env={**os.environ, "DISPLAY": DISPLAY},
|
||||
capture_output=True, timeout=5,
|
||||
env=env, capture_output=True, timeout=5,
|
||||
)
|
||||
log.debug("anti_idle mousemove fallback")
|
||||
except Exception as e:
|
||||
log.debug("anti_idle error: %s", e)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user