Skip to content

Commit

Permalink
feat: update the active workspace when a monitor gets focused (#41)
Browse files Browse the repository at this point in the history
  • Loading branch information
autumnWindigo authored Aug 22, 2024
1 parent 17a9933 commit b40263b
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion fabric/hyprland/widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

gi.require_version("Gtk", "3.0")
from gi.repository import (
Gtk,
Gdk,
GLib,
)
Expand Down Expand Up @@ -183,6 +182,7 @@ def __init__(
"workspace": self.on_workspace,
"createworkspace": self.on_createworkspace,
"destroyworkspace": self.on_destroyworkspace,
"focusedmon": self.on_focusedmon,
"urgent": self.on_urgent,
},
)
Expand Down Expand Up @@ -217,6 +217,10 @@ def on_destroyworkspace(self, obj, event):
button_obj.set_empty()
return logger.info(f"[Workspaces] Workspace {event.data[0]} destroyed")

def on_focusedmon(self, obj, event: HyprlandEvent):
GLib.idle_add(self.set_active_workspace, (int(event.data[1]) - 1))
return logger.info(f"[Workspaces] Monitor focused to {event.data[0]}. Active workspace changed to {event.data[1]}")

def on_urgent(self, obj, event: HyprlandEvent):
clients = json.loads(
str(
Expand Down

0 comments on commit b40263b

Please sign in to comment.