Resolve socket path from uid when XDG_RUNTIME_DIR is unset
This commit is contained in:
+8
-3
@@ -10,9 +10,14 @@ import time
|
|||||||
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
|
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
|
||||||
import asrock_hid as h
|
import asrock_hid as h
|
||||||
|
|
||||||
SOCK_PATH = os.environ.get(
|
def sock_path():
|
||||||
"ASROCK_SOCK", os.path.join(os.environ.get("XDG_RUNTIME_DIR", "/tmp"), "asrock-led.sock")
|
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
|
FRAME = 0.05
|
||||||
|
|
||||||
NATIVE_TAKES_COLOR = {
|
NATIVE_TAKES_COLOR = {
|
||||||
|
|||||||
Reference in New Issue
Block a user