1
0
mirror of https://github.com/slgobinath/SafeEyes.git synced 2024-12-28 00:10:44 +01:00

Check if using wayland via WAYLAND_DISPLAY env variable (#484)

My distro does not install loginctl. I have implemented another easy
condition for wayland.

https://stackoverflow.com/questions/45536141/how-i-can-find-out-if-a-linux-system-uses-wayland-or-x11/45537237#45537237
This commit is contained in:
Anjan Momi 2022-10-13 11:52:47 -04:00 committed by GitHub
parent 29a1e15192
commit dd16395471
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -302,6 +302,13 @@ def is_wayland():
https://unix.stackexchange.com/a/325972/222290
"""
global IS_WAYLAND
# Easy method. Does not depend on loginctl
# https://stackoverflow.com/questions/45536141/how-i-can-find-out-if-a-linux-system-uses-wayland-or-x11/45537237#45537237
if "WAYLAND_DISPLAY" in os.environ:
IS_WAYLAND = True
return IS_WAYLAND
try:
session_id = subprocess.check_output(['loginctl']).split(b'\n')[1].split()[0]
output = subprocess.check_output(