mirror of
https://github.com/GeorgeSG/dotfiles.git
synced 2026-09-07 17:58:45 +00:00
Add hyprstack config
This commit is contained in:
Binary file not shown.
@@ -0,0 +1,10 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
from hyprsocket import run_on_line
|
||||
|
||||
|
||||
def get_kb_layout(line):
|
||||
print(line)
|
||||
|
||||
|
||||
run_on_line(get_kb_layout)
|
||||
@@ -0,0 +1,14 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
from hyprsocket import run_on_line
|
||||
|
||||
|
||||
def get_kb_layout(line):
|
||||
if "activelayout" in line:
|
||||
res = line.split(">>")[1]
|
||||
language = res.split(",")[1]
|
||||
lang_short = language[0:2]
|
||||
print("bg" if lang_short == "Bu" else "en", flush=True)
|
||||
|
||||
|
||||
run_on_line(get_kb_layout)
|
||||
@@ -0,0 +1,24 @@
|
||||
import socket
|
||||
import os, os.path
|
||||
|
||||
|
||||
def get_socket_path():
|
||||
XDG_RUNTIME_DIR = os.getenv("XDG_RUNTIME_DIR")
|
||||
HYPRLAND_INSTANCE_SIGNATURE = os.getenv("HYPRLAND_INSTANCE_SIGNATURE")
|
||||
|
||||
socket_path = os.path.join(
|
||||
XDG_RUNTIME_DIR, "hypr", HYPRLAND_INSTANCE_SIGNATURE, ".socket2.sock"
|
||||
)
|
||||
|
||||
return socket_path
|
||||
|
||||
|
||||
def run_on_line(method):
|
||||
server = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
|
||||
server.connect(get_socket_path())
|
||||
|
||||
while True:
|
||||
data_chunk = server.recv(4096)
|
||||
if data_chunk:
|
||||
line = data_chunk.decode("utf-8")
|
||||
method(line)
|
||||
Reference in New Issue
Block a user