However, this broke linux-desktop-audit. So, instead of listening to 'active_workspace_changed' the code should be listening to 'viewports_changed'. Once this event fires, to get the current workspace number I use the following code:
def viewport_change (self, screen):
self.current_workspace = screen.get_active_workspace()
v_x = self.current_workspace.get_viewport_x()
v_y = self.current_workspace.get_viewport_y()
v_w = screen.get_width()
v_h = screen.get_height()
v_r = self.current_workspace.get_width()
v_c = self.current_workspace.get_height()
total_cols = v_r/v_w
total_rows = v_c/v_h
desk_col = v_x/v_w
desk_row = v_y/v_h
ws_num = desk_col + (desk_row * total_cols)
No comments:
Post a Comment