MCPcopy Index your code
hub / github.com/material-shell/material-shell / window_manager

Function window_manager

scripts/install.py:36–47  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

34
35
36def window_manager() -> str:
37 sessions = json.loads(subprocess.check_output(["loginctl", "--output=json"]).decode('utf-8'))
38 username = getpass.getuser()
39 sessionIds = [r["session"] for r in sessions if r["user"] == username]
40 window_manager = "unknown"
41 for sessionId in sessionIds:
42 if subprocess.check_output(["loginctl", "show-session", str(sessionId), "-p", "Active", "--value"]).decode('utf-8').strip() == "yes":
43 # Found the active session, get the window manager name from it
44 window_manager = subprocess.check_output(
45 ["loginctl", "show-session", str(sessionId), "-p", "Type", "--value"]).decode('utf-8').strip()
46
47 return window_manager
48
49
50def install():

Callers 1

installFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected