Merge pull request #294 from nwg-piotr/runtimedir

Support socket files moved to $XDG_RUNTIME_DIR/hypr
This commit is contained in:
Piotr Miller
2024-05-01 01:24:06 +02:00
committed by GitHub
3 changed files with 16 additions and 4 deletions

View File

@@ -158,8 +158,12 @@ def restart():
def hypr_watcher():
import socket
# /tmp/hypr moved to $XDG_RUNTIME_DIR/hypr in #5788
hypr_dir = f"{os.getenv("XDG_RUNTIME_DIR")}/hypr" if os.path.isdir(
f"{os.getenv("XDG_RUNTIME_DIR")}/hypr") else "/tmp/hypr"
client = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
client.connect("/tmp/hypr/{}/.socket2.sock".format(his))
client.connect(f"{hypr_dir}/{his}/.socket2.sock")
global last_client_addr, last_client_title
client_addr, client_title = None, None

View File

@@ -2,7 +2,7 @@
"""
nwg-shell helper script to preview system processes
Copyright (c) 2023 Piotr Miller
Copyright (c) 2023-2024 Piotr Miller
e-mail: nwg.piotr@gmail.com
GitHub: https://github.com/nwg-piotr/nwg-panel
Project: https://nwg-piotr.github.io/nwg-shell
@@ -45,8 +45,12 @@ btn_pid, btn_ppid, btn_owner, btn_cpu, btn_mem, btn_name = None, None, None, Non
def hyprctl(cmd):
# /tmp/hypr moved to $XDG_RUNTIME_DIR/hypr in #5788
hypr_dir = f"{os.getenv("XDG_RUNTIME_DIR")}/hypr" if os.path.isdir(
f"{os.getenv("XDG_RUNTIME_DIR")}/hypr") else "/tmp/hypr"
s = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
s.connect("/tmp/hypr/{}/.socket.sock".format(os.getenv("HYPRLAND_INSTANCE_SIGNATURE")))
s.connect(f"{hypr_dir}/{os.getenv("HYPRLAND_INSTANCE_SIGNATURE")}/.socket.sock")
s.send(cmd.encode("utf-8"))
output = s.recv(20480).decode('utf-8')

View File

@@ -820,9 +820,13 @@ def load_shell_data():
def hyprctl(cmd, buf_size=2048):
# /tmp/hypr moved to $XDG_RUNTIME_DIR/hypr in #5788
hypr_dir = f"{os.getenv("XDG_RUNTIME_DIR")}/hypr" if os.path.isdir(
f"{os.getenv("XDG_RUNTIME_DIR")}/hypr") else "/tmp/hypr"
s = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
try:
s.connect("/tmp/hypr/{}/.socket.sock".format(os.getenv("HYPRLAND_INSTANCE_SIGNATURE")))
s.connect(f"{hypr_dir}/{os.getenv("HYPRLAND_INSTANCE_SIGNATURE")}/.socket.sock")
s.send(cmd.encode("utf-8"))
output = b""