Skip to content

Commit 91c6fa3

Browse files
committed
fix(workspace): prevent komorebi widget freeze and broken states after auto-hide (#902)
- Replaced dynamic `get_monitor_hwnd` calls with cached `self.monitor_hwnd` to prevent the widget from dropping background updates when the bar is hidden and lacks physical dimensions. - Updated `update_visible_buttons` to use `not btn.isHidden()` instead of `btn.isVisible()`, ensuring sequential CSS classes are correctly assigned to workspace buttons even while the parent bar is temporarily invisible.
1 parent 5721094 commit 91c6fa3

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

src/core/widgets/komorebi/workspaces.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ def __init__(
5555
self.update_and_redraw(self.status)
5656

5757
def update_visible_buttons(self):
58-
visible_buttons = [btn for btn in self.parent_widget._workspace_buttons if btn.isVisible()]
58+
visible_buttons = [btn for btn in self.parent_widget._workspace_buttons if not btn.isHidden()]
5959
for index, button in enumerate(visible_buttons):
6060
current_class = button.property("class")
6161
new_class = " ".join([cls for cls in current_class.split() if not cls.startswith("button-")])
@@ -124,7 +124,7 @@ def mousePressEvent(self, event: QMouseEvent):
124124
self.activate_workspace()
125125

126126
def update_visible_buttons(self):
127-
visible_buttons = [btn for btn in self.parent_widget._workspace_buttons if btn.isVisible()]
127+
visible_buttons = [btn for btn in self.parent_widget._workspace_buttons if not btn.isHidden()]
128128
for index, button in enumerate(visible_buttons):
129129
current_class = button.property("class")
130130
new_class = " ".join([cls for cls in current_class.split() if not cls.startswith("button-")])
@@ -402,7 +402,7 @@ def _clear_container_layout(self):
402402

403403
def _update_komorebi_state(self, komorebi_state: dict) -> bool:
404404
try:
405-
self._screen_hwnd = get_monitor_hwnd(int(QWidget.winId(self)))
405+
self._screen_hwnd = self.monitor_hwnd or get_monitor_hwnd(int(QWidget.winId(self)))
406406
self._komorebi_state = komorebi_state
407407
if self._komorebi_state:
408408
self._komorebi_screen = self._komorebic.get_screen_by_hwnd(self._komorebi_state, self._screen_hwnd)

0 commit comments

Comments
 (0)