From e6a4c48b2ff236dc9ced480d14762240a775476e Mon Sep 17 00:00:00 2001 From: S4NKALP Date: Tue, 16 Jun 2026 22:23:44 +0545 Subject: [PATCH] feat(root): add hyprland integration and update dependenciesUpdate Fabric dependency to latest commit, pin versions in requirements.txt, enable Windows Subsystem for Linux support and add monkeypatch for hyprland dispatcher to ensure correct Lua calls --- pyproject.toml | 6 +++--- requirements.txt | 12 +++++++----- start.py | 1 + test_regex.py | 37 +++++++++++++++++++++++++++++++++++++ uv.lock | 8 ++++---- 5 files changed, 52 insertions(+), 12 deletions(-) create mode 100644 test_regex.py diff --git a/pyproject.toml b/pyproject.toml index 04f8139..c991cdd 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -19,9 +19,6 @@ dev = [ "ruff>=0.15.2", ] -[tool.uv.sources] -fabric = { git = "https://github.com/Fabric-Development/fabric.git" } - [project.scripts] start = "main:main" lock = "lock:main" @@ -35,3 +32,6 @@ packages = ["src/shared", "src/utils", "src/window", "src/services", "src/main.p [tool.hatch.build.targets.wheel.sources] "src" = "" + +[tool.uv.sources] +fabric = { git = "https://github.com/Fabric-Development/fabric.git" } diff --git a/requirements.txt b/requirements.txt index a40480a..cf86b6d 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,8 @@ -fabric @ git+https://github.com/Fabric-Development/fabric.git@fd2aabbd7e1859aa7c11c626a6c36a937aca736a -pam>=0.2.0 -psutil>=7.2.2 + +fabric @ git+https://github.com/Fabric-Development/fabric.git@b7b0f9975f0cf161ccf81c1adfb181230d553f79 +httpx==0.28.1 +pam==0.2.0 +psutil==7.2.2 pywayland==0.4.18 -six>=1.17.0 -httpx>=0.28.1 \ No newline at end of file +ruff==0.15.12 +six==1.17.0 diff --git a/start.py b/start.py index ab3308b..10ac8ff 100644 --- a/start.py +++ b/start.py @@ -8,6 +8,7 @@ if src_path not in sys.path: sys.path.insert(0, src_path) +# Apply monkey patch for hyprland lua dispatcher def run_app(): from main import main as app_main diff --git a/test_regex.py b/test_regex.py new file mode 100644 index 0000000..87a91ae --- /dev/null +++ b/test_regex.py @@ -0,0 +1,37 @@ +import re + + +def hypr_patch(cmd): + if not isinstance(cmd, str) or "dispatch" not in cmd: + return cmd + + if "hyprctl dispatch" in cmd: + match = re.search(r"hyprctl dispatch (\w+)(.*)", cmd) + if match: + disp, args = match.group(1), match.group(2).strip(" '\"") + if disp == "workspace": + lua = f"hl.dsp.focus({{workspace=[[{args}]]}})" + elif disp == "movetoworkspace": + lua = f"hl.dsp.window.move({{workspace=[[{args}]]}})" + else: + disp = "exec_cmd" if disp == "exec" else disp + lua = f"hl.dsp.{disp}([[{args}]])" if args else f"hl.dsp.{disp}()" + cmd = cmd.replace(match.group(0), f"hyprctl eval '{lua}'") + + cmd = re.sub( + r"dispatch workspace ([^\s;]+)", + r"dispatch hl.dsp.focus({workspace=[[\1]]})", + cmd, + ) + cmd = re.sub( + r"dispatch movetoworkspace ([^\s;]+)", + r"dispatch hl.dsp.window.move({workspace=[[\1]]})", + cmd, + ) + + return cmd + + +print(hypr_patch("batch/dispatch workspace 1")) +print(hypr_patch("hyprctl dispatch exec 'uwsm app -- kitty'")) +print(hypr_patch("hyprctl dispatch workspace e+1")) diff --git a/uv.lock b/uv.lock index 2fb5a1b..74d2df5 100644 --- a/uv.lock +++ b/uv.lock @@ -70,14 +70,14 @@ wheels = [ [[package]] name = "click" -version = "8.3.3" +version = "8.4.1" source = { registry = "https://pypi.org/simple" } dependencies = [ { name = "colorama", marker = "sys_platform == 'win32'" }, ] -sdist = { url = "https://files.pythonhosted.org/packages/bb/63/f9e1ea081ce35720d8b92acde70daaedace594dc93b693c869e0d5910718/click-8.3.3.tar.gz", hash = "sha256:398329ad4837b2ff7cbe1dd166a4c0f8900c3ca3a218de04466f38f6497f18a2", size = 328061, upload-time = "2026-04-22T15:11:27.506Z" } +sdist = { url = "https://files.pythonhosted.org/packages/9b/98/518d8e5081007684232226f475082b30087d0f585e8457db087298259f49/click-8.4.1.tar.gz", hash = "sha256:918b5633eddf6b41c32d4f454bf0de810065c74e3f7dbf8ee5452f8be88d3e96", size = 353007, upload-time = "2026-05-22T04:08:37.769Z" } wheels = [ - { url = "https://files.pythonhosted.org/packages/ae/44/c1221527f6a71a01ec6fbad7fa78f1d50dfa02217385cf0fa3eec7087d59/click-8.3.3-py3-none-any.whl", hash = "sha256:a2bf429bb3033c89fa4936ffb35d5cb471e3719e1f3c8a7c3fff0b8314305613", size = 110502, upload-time = "2026-04-22T15:11:25.044Z" }, + { url = "https://files.pythonhosted.org/packages/c7/0d/67e5b4109ea4a837e80daa87c2c696711955e40449a97e8926672534def2/click-8.4.1-py3-none-any.whl", hash = "sha256:482be17c6991b8c19c5429a1e995d9b0efdbb63172824c41f99965dc0ade8ec2", size = 116639, upload-time = "2026-05-22T04:08:35.26Z" }, ] [[package]] @@ -92,7 +92,7 @@ wheels = [ [[package]] name = "fabric" version = "0.0.2" -source = { git = "https://github.com/Fabric-Development/fabric.git#23cab85fc61f1cdbb5f60db0027dc57026ba05b7" } +source = { git = "https://github.com/Fabric-Development/fabric.git#b7b0f9975f0cf161ccf81c1adfb181230d553f79" } dependencies = [ { name = "click" }, { name = "loguru" },