(direction, backDirection)
| 2574 | } |
| 2575 | |
| 2576 | moveToMonitor(direction, backDirection) { |
| 2577 | const monitor = focusMonitor(); |
| 2578 | const i = display.get_monitor_neighbor_index(monitor.index, direction); |
| 2579 | if (i === -1) |
| 2580 | return; |
| 2581 | |
| 2582 | if (this.lteSpacesThanMonitors( |
| 2583 | (s, m) => Main.notify( |
| 2584 | `PaperWM (cannot move workspace)`, |
| 2585 | `You need at least ${m + 1} workspaces to complete this operation.` |
| 2586 | ) |
| 2587 | )) { |
| 2588 | return; |
| 2589 | } |
| 2590 | |
| 2591 | // check how many spaces are on this monitor |
| 2592 | const numSpaces = [...this].filter(([_monitor, space]) => space?.monitor === monitor).length; |
| 2593 | // if last space on this monitor, then swap |
| 2594 | if (numSpaces <= 1) { |
| 2595 | this.swapMonitor(direction, backDirection); |
| 2596 | return; |
| 2597 | } |
| 2598 | |
| 2599 | let navFinish = () => Navigator.getNavigator().finish(); |
| 2600 | // action on current monitor |
| 2601 | this.selectStackSpace(Meta.MotionDirection.DOWN); |
| 2602 | navFinish(); |
| 2603 | // switch to target monitor and action mru |
| 2604 | this.switchMonitor(direction, false, true); |
| 2605 | this.selectStackSpace(Meta.MotionDirection.DOWN); |
| 2606 | navFinish(); |
| 2607 | |
| 2608 | // /** |
| 2609 | // * Fullscreen monitor workaround. |
| 2610 | // * see https://github.com/paperwm/PaperWM/issues/638 |
| 2611 | // */ |
| 2612 | // this.forEach(space => { |
| 2613 | // space.getWindows().filter(w => w.fullscreen).forEach(w => { |
| 2614 | // animateWindow(w); |
| 2615 | // w.unmake_fullscreen(); |
| 2616 | // w.make_fullscreen(); |
| 2617 | // showWindow(w); |
| 2618 | // }); |
| 2619 | // }); |
| 2620 | |
| 2621 | // ensure after swapping that the space elements are shown correctly |
| 2622 | this.forEach(s => s.setSpaceTopbarElementsVisible(true, { force: true })); |
| 2623 | } |
| 2624 | |
| 2625 | swapMonitor(direction, backDirection, options = {}) { |
| 2626 | const checkIfLast = options.checkIfLast ?? true; |
no test coverage detected