(direction, move, warp = true)
| 2533 | } |
| 2534 | |
| 2535 | switchMonitor(direction, move, warp = true) { |
| 2536 | let focus = display.focus_window; |
| 2537 | let monitor = focusMonitor(); |
| 2538 | let currentSpace = this.monitors.get(monitor); |
| 2539 | let i = display.get_monitor_neighbor_index(monitor.index, direction); |
| 2540 | if (i === -1) |
| 2541 | return; |
| 2542 | let newMonitor = Main.layoutManager.monitors[i]; |
| 2543 | if (warp) { |
| 2544 | Utils.warpPointerToMonitor(newMonitor); |
| 2545 | } |
| 2546 | let space = this.monitors.get(newMonitor); |
| 2547 | |
| 2548 | if (move && focus) { |
| 2549 | let metaWindow = focus.get_transient_for() || focus; |
| 2550 | |
| 2551 | if (currentSpace && currentSpace.indexOf(metaWindow) !== -1) { |
| 2552 | currentSpace.removeWindow(metaWindow); |
| 2553 | metaWindow.foreach_transient(t => { |
| 2554 | currentSpace.removeWindow(t); |
| 2555 | }); |
| 2556 | } else { |
| 2557 | metaWindow.move_to_monitor(newMonitor.index); |
| 2558 | } |
| 2559 | metaWindow.foreach_transient(t => { |
| 2560 | t.move_to_monitor(newMonitor.index); |
| 2561 | }); |
| 2562 | if (space) { |
| 2563 | metaWindow.change_workspace(space.workspace); |
| 2564 | metaWindow.foreach_transient(t => { |
| 2565 | space.addFloating(t); |
| 2566 | }); |
| 2567 | space.activateWithFocus(focus, false, false); |
| 2568 | } else { |
| 2569 | metaWindow.move_to_monitor(newMonitor.index); |
| 2570 | } |
| 2571 | } else { |
| 2572 | space.activate(false, false); |
| 2573 | } |
| 2574 | } |
| 2575 | |
| 2576 | moveToMonitor(direction, backDirection) { |
| 2577 | const monitor = focusMonitor(); |
no test coverage detected