예제 #1
0
	def focusstack(self, user_event: UserEvent):
		direction = user_event.parameters[0]
		window = get_active_managed_window()
		if not window:
			return
		monitor = monitors.get_active(window)
		clients = monitor.clients

		old_index = clients.index(window.get_xid())
		new_index = (old_index + direction) % len(clients)

		active_window.change_to(clients[new_index])
예제 #2
0
	def pushstack(self, user_event: UserEvent):
		direction = user_event.parameters[0]
		window = get_active_managed_window()
		if not window:
			return
		monitor = monitors.get_active(window)
		clients = monitor.clients
		old_index = clients.index(window.get_xid())
		new_index = (old_index + direction) % len(clients)

		if new_index != old_index:
			clients.insert(new_index, clients.pop(old_index))
			monitor.apply()
예제 #3
0
	def zoom(self, user_event: UserEvent):
		active = get_active_managed_window()
		monitor = monitors.get_active(active)
		clients = monitor.clients
		if not active:
			return
		if len(clients) >= 2:
			old_index = clients.index(active.get_xid())
			if old_index == 0:
				clients.insert(1, clients.pop(old_index))
			else:
				clients.insert(0, clients.pop(old_index))
			active_window.change_to(clients[0])
		monitor.apply()
예제 #4
0
	def pushmonitor(self, user_event: UserEvent):
		direction = user_event.parameters[0]
		window = get_active_managed_window()
		if not window:
			return
		origin = monitors.get_active(window)
		destinantion = monitors.get_secondary() if direction == 1 else monitors.get_primary()
		if not destinantion:
			return

		origin.clients.remove(window.get_xid())
		destinantion.clients.append(window.get_xid())

		origin.apply()
		destinantion.apply()
예제 #5
0
	def setlayout(self, user_event: UserEvent):
		promote_selected = False if len(user_event.parameters) < 2 else user_event.parameters[1]
		active = get_active_managed_window()
		monitor = monitors.get_active(active)
		clients = monitor.clients
		if promote_selected and active:
			old_index = clients.index(active.get_xid())
			clients.insert(0, clients.pop(old_index))

		if user_event.parameters:
			new_function_key = user_event.parameters[0]
		else:
			new_function_key = monitor.last_function_key
		monitor.set_layout(new_function_key)
		monitor.apply(unmaximize=True)
		windows.apply_decoration_config()
예제 #6
0
	def get_active(self, window: Wnck.Window = None) -> Monitor:
		if not window:
			window = get_active_managed_window()
		return self.of(window.get_workspace(), monitor_of(window.get_xid())) if window else self.get_primary()