| 34 | |
| 35 | |
| 36 | def 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 | |
| 50 | def install(): |