Advertisement
bluebyt

go_next_workspace.py

Nov 9th, 2024
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/usr/bin/python3
  2. from wayfire import WayfireSocket
  3. from wayfire.extra.ipc_utils import WayfireUtils
  4. import itertools
  5. sock = WayfireSocket()
  6. utils = WayfireUtils(sock)
  7.  
  8. def go_next_workspace():
  9.     grid_info = utils.get_active_workspace_info()
  10.     current_x, current_y = grid_info['x'], grid_info['y']
  11.     grid_width, grid_height = grid_info['grid_width'], grid_info['grid_height']
  12.     next_ws = None
  13.  
  14.     if current_x < grid_width - 1:
  15.         next_ws = {'x': current_x + 1, 'y': current_y}
  16.     else:
  17.         next_ws = {'x': 0, 'y': current_y + 1 if current_y < grid_height - 1 else 0}
  18.    
  19.     if next_ws:
  20.         sock.set_workspace(next_ws)
  21.        
  22. go_next_workspace()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement