| 340 | child.update_layout() |
| 341 | |
| 342 | def workspaces_scroll(self, difference: int): |
| 343 | if not SERVICE: |
| 344 | return |
| 345 | |
| 346 | fixed_enabled = user_settings.interface.modules.options.fixed_workspaces_enabled |
| 347 | fixed_amount = user_settings.interface.modules.options.fixed_workspaces_amount |
| 348 | |
| 349 | active_workspace_id = None |
| 350 | |
| 351 | if isinstance(SERVICE, NiriService): |
| 352 | active_workspace_niri = next( |
| 353 | (ws for ws in SERVICE.workspaces if ws.is_active), None |
| 354 | ) |
| 355 | if active_workspace_niri: |
| 356 | active_workspace_id = active_workspace_niri.idx |
| 357 | else: |
| 358 | print("No active Niri workspace found.") |
| 359 | return |
| 360 | |
| 361 | elif isinstance(SERVICE, HyprlandService): |
| 362 | active_workspace_hyprland = SERVICE.active_workspace |
| 363 | if active_workspace_hyprland: |
| 364 | active_workspace_id = active_workspace_hyprland.id |
| 365 | else: |
| 366 | print("No active Hyprland workspace found.") |
| 367 | return |
| 368 | |
| 369 | if active_workspace_id is not None: |
| 370 | new_workspace_id = active_workspace_id + difference |
| 371 | SERVICE.switch_to_workspace(new_workspace_id) |
| 372 | |
| 373 | def widget(self): |
| 374 | return self |