fix: Hyprland config update, eww bar integration #15
|
@ -65,7 +65,7 @@
|
||||||
(for workspace in workspaces
|
(for workspace in workspaces
|
||||||
(button
|
(button
|
||||||
:class "${workspace.class}"
|
:class "${workspace.class}"
|
||||||
:onclick "scripts/workspace.sh ${workspace.id}"
|
:onclick "scripts/compositor-control set-workspace ${workspace.id}"
|
||||||
"${workspace.text}"))
|
"${workspace.text}"))
|
||||||
))
|
))
|
||||||
(deflisten workspaces :initial "[]"
|
(deflisten workspaces :initial "[]"
|
||||||
|
|
|
@ -67,6 +67,8 @@ class CompositorHandler:
|
||||||
pass
|
pass
|
||||||
def listen_active_window_title(self):
|
def listen_active_window_title(self):
|
||||||
pass
|
pass
|
||||||
|
def set_workspace(self, i):
|
||||||
|
pass
|
||||||
|
|
||||||
class HyprlandHandler(CompositorHandler):
|
class HyprlandHandler(CompositorHandler):
|
||||||
def __init__(self, socket_addr):
|
def __init__(self, socket_addr):
|
||||||
|
@ -125,6 +127,15 @@ class HyprlandHandler(CompositorHandler):
|
||||||
print(title, flush=True)
|
print(title, flush=True)
|
||||||
self.listen(callback)
|
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):
|
class SwayHandler(CompositorHandler):
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
@ -163,5 +174,11 @@ if __name__ == "__main__":
|
||||||
handler.listen_workspaces()
|
handler.listen_workspaces()
|
||||||
elif key == "active-title":
|
elif key == "active-title":
|
||||||
handler.listen_active_window_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:
|
else:
|
||||||
print(f"Unknown key: {key}", file=sys.stderr)
|
print(f"Unknown key: {key}", file=sys.stderr)
|
||||||
|
|
|
@ -1,4 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
hyprctl dispatch workspace $1
|
|
||||||
~/.config/hypr/wallpaper.sh $1
|
|
Loading…
Reference in New Issue