Resolve socket path from uid when XDG_RUNTIME_DIR is unset

This commit is contained in:
2026-09-08 00:17:21 -05:00
parent 1a42b1f7f2
commit 770e81f666
+8 -3
View File
@@ -10,9 +10,14 @@ import time
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
import asrock_hid as h
SOCK_PATH = os.environ.get(
"ASROCK_SOCK", os.path.join(os.environ.get("XDG_RUNTIME_DIR", "/tmp"), "asrock-led.sock")
)
def sock_path():
rt = os.environ.get("XDG_RUNTIME_DIR")
if not rt:
rt = "/run/user/%d" % os.getuid()
return os.path.join(rt, "asrock-led.sock")
SOCK_PATH = os.environ.get("ASROCK_SOCK") or sock_path()
FRAME = 0.05
NATIVE_TAKES_COLOR = {