code: def move_window(pymux, variables):
      
      dst_window = variables['<dst-window>']
      try:
          new_index = int(dst_window)
      except ValueError:
          raise CommandException('Invalid window index: %r' % (dst_window, ))
  
      # Check first whether the index was not yet taken.
      if pymux.arrangement.get_window_by_index(new_index):
          raise CommandException("Can't move window: index in use.")
  
      # Save index.
      w = pymux.arrangement.get_active_window()
      pymux.arrangement.move_window(w, new_index)
docs: Move window to a new index.