Advertisement
bluebyt

go_previous_workspace.py

Nov 9th, 2024
87
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.  
  9. def go_previous_workspace():
  10.         grid_info = utils.get_active_workspace_info()
  11.         current_x, current_y = grid_info['x'], grid_info['y']
  12.         grid_width, grid_height = grid_info['grid_width'], grid_info['grid_height']
  13.         previous = None
  14.         if current_x > 0:
  15.             previous =  {'x': current_x - 1, 'y': current_y  if current_x > 0 else grid_width - 1}
  16.         if current_x == 0:
  17.             previous = {'x': grid_width - 1, 'y': current_y - 1 if current_y > 0 else grid_height - 1}
  18.         if previous:
  19.             sock.set_workspace(previous)
  20.  
  21. go_previous_workspace()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement