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

Class Workspaces

ignis/modules/bar/widgets/workspaces.py:167–374  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

165
166
167class Workspaces(widgets.EventBox):
168 def __init__(self):
169 self._workspace_box = widgets.Box(
170 css_classes=["workspaces"],
171 halign="center",
172 hexpand=True,
173 valign="center",
174 vexpand=True,
175 )
176 user_settings.interface.modules.options.connect_option(
177 "workspaces_style", lambda: self.update_workspaces()
178 )
179 user_settings.interface.modules.options.connect_option(
180 "fixed_workspaces_enabled", lambda: self.update_workspaces()
181 )
182 user_settings.interface.modules.options.connect_option(
183 "fixed_workspaces_amount", lambda: self.update_workspaces()
184 )
185
186 super().__init__(
187 child=[self._workspace_box],
188 on_scroll_up=lambda self: self.workspaces_scroll(+1),
189 on_scroll_down=lambda self: self.workspaces_scroll(-1),
190 )
191
192 self._last_style = None
193 self._last_workspace_ids = []
194 self._last_fixed_enabled = False
195
196 if SERVICE:
197 SERVICE.connect("notify::workspaces", self.update_workspaces)
198 SERVICE.connect("notify::active-workspace", self.update_workspaces)
199 self.update_workspaces()
200
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 (

Callers 1

__init__Method · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected