use syntax valid in pre-3.12 python versions #296

This commit is contained in:
piotr
2024-05-03 00:44:43 +02:00
parent 794e3fb1e5
commit 84e01967e2
3 changed files with 9 additions and 6 deletions

View File

@@ -159,8 +159,9 @@ def hypr_watcher():
import socket import socket
# /tmp/hypr moved to $XDG_RUNTIME_DIR/hypr in #5788 # /tmp/hypr moved to $XDG_RUNTIME_DIR/hypr in #5788
hypr_dir = f"{os.getenv("XDG_RUNTIME_DIR")}/hypr" if os.path.isdir( xdg_runtime_dir = os.getenv("XDG_RUNTIME_DIR")
f"{os.getenv("XDG_RUNTIME_DIR")}/hypr") else "/tmp/hypr" hypr_dir = f"{xdg_runtime_dir}/hypr" if xdg_runtime_dir and os.path.isdir(
f"{xdg_runtime_dir}/hypr") else "/tmp/hypr"
client = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) client = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
client.connect(f"{hypr_dir}/{his}/.socket2.sock") client.connect(f"{hypr_dir}/{his}/.socket2.sock")

View File

@@ -46,8 +46,9 @@ btn_pid, btn_ppid, btn_owner, btn_cpu, btn_mem, btn_name = None, None, None, Non
def hyprctl(cmd): def hyprctl(cmd):
# /tmp/hypr moved to $XDG_RUNTIME_DIR/hypr in #5788 # /tmp/hypr moved to $XDG_RUNTIME_DIR/hypr in #5788
hypr_dir = f"{os.getenv("XDG_RUNTIME_DIR")}/hypr" if os.path.isdir( xdg_runtime_dir = os.getenv("XDG_RUNTIME_DIR")
f"{os.getenv("XDG_RUNTIME_DIR")}/hypr") else "/tmp/hypr" hypr_dir = f"{xdg_runtime_dir}/hypr" if xdg_runtime_dir and os.path.isdir(
f"{xdg_runtime_dir}/hypr") else "/tmp/hypr"
s = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) s = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
s.connect(f"{hypr_dir}/{os.getenv("HYPRLAND_INSTANCE_SIGNATURE")}/.socket.sock") s.connect(f"{hypr_dir}/{os.getenv("HYPRLAND_INSTANCE_SIGNATURE")}/.socket.sock")

View File

@@ -821,8 +821,9 @@ def load_shell_data():
def hyprctl(cmd, buf_size=2048): def hyprctl(cmd, buf_size=2048):
# /tmp/hypr moved to $XDG_RUNTIME_DIR/hypr in #5788 # /tmp/hypr moved to $XDG_RUNTIME_DIR/hypr in #5788
hypr_dir = f"{os.getenv("XDG_RUNTIME_DIR")}/hypr" if os.path.isdir( xdg_runtime_dir = os.getenv("XDG_RUNTIME_DIR")
f"{os.getenv("XDG_RUNTIME_DIR")}/hypr") else "/tmp/hypr" hypr_dir = f"{xdg_runtime_dir}/hypr" if xdg_runtime_dir and os.path.isdir(
f"{xdg_runtime_dir}/hypr") else "/tmp/hypr"
s = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) s = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
try: try: