示例#1
0
def move_to_new_temporary_space():
    ''' Move the active window to a new temporary space. '''
    if not pylewm.focus.FocusWindow:
        return
    if not pylewm.focus.FocusWindow.can_move():
        return
    if not pylewm.focus.FocusWindow.space:
        return
    move_window_to_new_temporary_space(pylewm.focus.FocusWindow)
    delay_pyle_command(
        0.05, lambda: pylewm.focus.set_focus(pylewm.focus.FocusWindow))
示例#2
0
def move_flip():
    window = pylewm.focus.FocusWindow
    if not window:
        return
    if not window.can_move():
        return

    space = get_flipped_space()
    if window.space:
        window.space.remove_window(window)
        space.add_window(window)

    space.monitor.switch_to_space(space)
    delay_pyle_command(0.05, lambda: pylewm.focus.set_focus(window))
示例#3
0
def move_to_space(monitor_index, space_index):
    window = pylewm.focus.FocusWindow
    if not window or not window.space:
        return
    if not window.can_move():
        return

    prev_space = window.space
    prev_space.remove_window(window)

    monitor = pylewm.monitors.get_monitor_by_index(monitor_index)
    space = monitor.spaces[space_index]
    space.add_window(window)

    if not space.visible:
        space.monitor.switch_to_space(space)

    delay_pyle_command(0.05, lambda: pylewm.focus.set_focus(window))
示例#4
0
def move_direction(direction):
    current_space = pylewm.focus.get_focused_space()
    focus_window = pylewm.focus.FocusWindow
    if not focus_window or focus_window.space != current_space:
        return
    if not focus_window.can_move():
        return

    handled, escape_direction = current_space.move_window_in_direction(
        focus_window, direction)
    if not handled:
        # Escape into a different monitor's space
        new_monitor = pylewm.monitors.get_monitor_in_direction(
            current_space.monitor, escape_direction)
        if new_monitor:
            current_space.remove_window(focus_window)
            new_monitor.visible_space.add_window(focus_window,
                                                 direction=escape_direction)

    delay_pyle_command(0.05, lambda: pylewm.focus.set_focus(focus_window))
示例#5
0
def goto_space(other_space):
    other_space.monitor.switch_to_space(other_space)

    if other_space.last_focus:
        focus_window = other_space.last_focus
        delay_pyle_command(0.05, lambda: pylewm.focus.set_focus(focus_window))
    elif other_space.windows:
        focus_window = other_space.windows[0]
        delay_pyle_command(0.05, lambda: pylewm.focus.set_focus(focus_window))
    else:
        delay_pyle_command(
            0.05, lambda: pylewm.focus.set_focus_monitor(other_space.monitor))