MCPcopy Create free account
hub / github.com/debuggyo/Exo / update_workspaces

Method update_workspaces

ignis/modules/bar/widgets/workspaces.py:203–319  ·  view source on GitHub ↗
(self, *args)

Source from the content-addressed store, hash-verified

201 self.update_layout()
202
203 def update_workspaces(self, *args):
204 bar = (
205 user_settings.interface.bar
206 if user_settings.interface.modules.bar_id.workspaces == 0
207 else user_settings.interface.bar2
208 )
209 current_style = user_settings.interface.modules.options.workspaces_style
210
211 current_workspace_ids = []
212 if SERVICE:
213 fixed_enabled = (
214 user_settings.interface.modules.options.fixed_workspaces_enabled
215 )
216 if isinstance(SERVICE, NiriService):
217 current_workspace_ids = [ws.idx for ws in SERVICE.workspaces]
218 elif isinstance(SERVICE, HyprlandService):
219 current_workspace_ids = [ws.id for ws in SERVICE.workspaces]
220
221 if fixed_enabled != self._last_fixed_enabled:
222 self._last_style = None
223 self._last_workspace_ids = []
224 if (
225 current_style != self._last_style
226 or current_workspace_ids != self._last_workspace_ids
227 ):
228 self._last_style = current_style
229 self._last_workspace_ids = current_workspace_ids
230
231 fixed_enabled = (
232 user_settings.interface.modules.options.fixed_workspaces_enabled
233 )
234 fixed_amount = int(
235 user_settings.interface.modules.options.fixed_workspaces_amount
236 )
237
238 self._workspace_box.remove_css_class("dots")
239 self._workspace_box.remove_css_class("windows")
240 self._workspace_box.remove_css_class("numbers")
241
242 if current_style == "dots":
243 self._workspace_box.add_css_class("dots")
244 elif current_style == "windows":
245 self._workspace_box.add_css_class("windows")
246 elif current_style == "numbers":
247 self._workspace_box.add_css_class("numbers")
248
249 if SERVICE:
250 last_child = self._workspace_box.get_last_child()
251 while last_child:
252 self._workspace_box.remove(last_child)
253 last_child = self._workspace_box.get_last_child()
254
255 workspaces_to_display = []
256 if SERVICE:
257 all_workspaces_map = {}
258 if isinstance(SERVICE, NiriService):
259 for ws in SERVICE.workspaces:
260 all_workspaces_map[ws.idx] = ws

Callers 2

__init__Method · 0.95
setWorkspacesStyleMethod · 0.80

Calls 4

get_active_workspaceFunction · 0.85
DummyWorkspaceClass · 0.85
WorkspaceButtonClass · 0.85
_update_iconsMethod · 0.80

Tested by

no test coverage detected