mirror of
https://github.com/aclist/dztui.git
synced 2026-08-27 18:27:07 +02:00
30 lines
658 B
Python
30 lines
658 B
Python
import re
|
|
import subprocess
|
|
|
|
CPU_FILE = "/proc/cpuinfo"
|
|
|
|
def is_steam_deck() -> bool:
|
|
# TODO: tests
|
|
r = r"AMD Custom APU [0-9]{4}"
|
|
with open(CPU_FILE, "r") as f:
|
|
s = f.read()
|
|
match = re.search(r, s)
|
|
if match:
|
|
if "0932" in match.group() or "0405" in match.group():
|
|
return True
|
|
return False
|
|
|
|
|
|
def is_game_mode() -> bool:
|
|
proc = subprocess.run(
|
|
["/usr/bin/pgrep", "-a", "gamescope"],
|
|
capture_output=True,
|
|
text=True
|
|
)
|
|
if proc.returncode != 0:
|
|
return False
|
|
if "generate-drm-mode" in proc.stdout:
|
|
return True
|
|
else:
|
|
return False
|