fix: Hyprland config update, eww bar integration #15

Merged
aniva merged 15 commits from wayland/hypr into main 2024-09-03 13:15:08 -07:00
3 changed files with 18 additions and 5 deletions
Showing only changes of commit 9147fa3fff - Show all commits

View File

@ -65,7 +65,7 @@
(for workspace in workspaces
(button
:class "${workspace.class}"
:onclick "scripts/workspace.sh ${workspace.id}"
:onclick "scripts/compositor-control set-workspace ${workspace.id}"
"${workspace.text}"))
))
(deflisten workspaces :initial "[]"

View File

@ -67,6 +67,8 @@ class CompositorHandler:
pass
def listen_active_window_title(self):
pass
def set_workspace(self, i):
pass
class HyprlandHandler(CompositorHandler):
def __init__(self, socket_addr):
@ -125,6 +127,15 @@ class HyprlandHandler(CompositorHandler):
print(title, flush=True)
self.listen(callback)
@override
def set_workspace(self, i):
result = os.popen(f"hyprctl dispatch workspace {i}").read()
if result != "ok\n":
raise RuntimeError(f"Failed to set workspace: {result}")
# FIXME: Set the wallpaper too.
# ~/.config/hypr/wallpaper.sh $1
class SwayHandler(CompositorHandler):
@staticmethod
@ -163,5 +174,11 @@ if __name__ == "__main__":
handler.listen_workspaces()
elif key == "active-title":
handler.listen_active_window_title()
elif key == "set-workspace":
if len(sys.argv) != 3:
print(f"Set workspace must be accompanied by an argument", file=sys.stderr)
arg = sys.argv[2]
handler.set_workspace(arg)
else:
print(f"Unknown key: {key}", file=sys.stderr)

View File

@ -1,4 +0,0 @@
#!/bin/bash
hyprctl dispatch workspace $1
~/.config/hypr/wallpaper.sh $1