mirror of
https://github.com/DeeJanuz/frametop.git
synced 2026-10-06 06:00:09 +02:00
Pause Frametop for VR games
Frametop kept using the headset during games: with gaze mode off, our eye tracker still took about 60% of a core, remote desktop about 2 cores while on, and KWin kept drawing hidden screens because ft-screens sent their frame callbacks at 90 Hz. Pausing gives that back, and resuming brings back only what pausing stopped. It's also a way to keep the gaze service and our eye tracker off during games, which PR #13 asked for. Paused (input/game_pause.py, run by the input relay): - frametop-gaze stops (ft-eyegrab then idles by itself), and hand tracking and remote desktop stop if they run - the desktop hides and slows down: ft-screens "pause on" hides every panel and sends KWin a frame callback once a second; or, with pause_desktop "close", the desktop closes and starts again on resume - the relay lets go of the 3D mouse, typing goes to Steam, and mapped buttons and key combinations do only pause_toggle, steam_menu and commands Toggled by both thumbsticks clicked together twice (configurable), read passively from vrserver's web socket (input/vrws.py) so it works in games and takes nothing from them; by the new pause_toggle action; by input/ft-pause; and, with pause_auto (default on), by a VR game starting and ending, which the pointer helper now reports ("vrgame 1|0"). Frametop Input Settings has a Games page for it. update-check.py checks the web socket, and doesn't count a paused gaze service as failed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
7fbcd177d3
commit
8aaf7db05a
18 files changed
+1534
-41
No files matched your search
Executable
+45
@@ -0,0 +1,45 @@
|
||||
#!/usr/bin/python3
|
||||
"""ft-pause: pause Frametop for a VR game, so it leaves the CPU and GPU to the game, or resume it.
|
||||
|
||||
ft-pause on|off|toggle pause or resume (input/game_pause.py has what pausing stops)
|
||||
ft-pause status the pause state, as JSON (the default)
|
||||
|
||||
The input relay does it (frametop-input-relay.service). So do the pause_toggle action, the
|
||||
controller gesture (by default both thumbsticks clicked together twice), and, with auto pause on,
|
||||
a VR game starting; Frametop Input Settings has the settings, on its Games page.
|
||||
"""
|
||||
|
||||
import json
|
||||
import os
|
||||
import socket
|
||||
import sys
|
||||
|
||||
|
||||
def ask(msg, timeout=2.0):
|
||||
s = socket.socket(socket.AF_UNIX, socket.SOCK_DGRAM | socket.SOCK_CLOEXEC)
|
||||
s.bind(f"\0ft_pause.{os.getpid()}")
|
||||
s.settimeout(timeout)
|
||||
try:
|
||||
s.sendto(msg.encode(), "\0frametop_relay")
|
||||
return json.loads(s.recv(65536))
|
||||
except ConnectionRefusedError:
|
||||
sys.exit("the input relay isn't running (frametop-input-relay.service)")
|
||||
except (socket.timeout, ValueError):
|
||||
sys.exit("no answer from the input relay (an older one, without pausing?)")
|
||||
finally:
|
||||
s.close()
|
||||
|
||||
|
||||
def main():
|
||||
cmd = sys.argv[1] if len(sys.argv) > 1 else "status"
|
||||
if cmd in ("on", "off", "toggle"):
|
||||
r = ask(f"pause {cmd} command")
|
||||
print("Frametop paused" if r.get("paused") else "Frametop running")
|
||||
elif cmd == "status":
|
||||
print(json.dumps(ask("pause ?"), indent=1))
|
||||
else:
|
||||
sys.exit(__doc__)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in new issue
Block a user