* Updates save state based on current monitors, spaces, and layouts.
(save = true)
| 3855 | * Updates save state based on current monitors, spaces, and layouts. |
| 3856 | */ |
| 3857 | update(save = true) { |
| 3858 | if (!save) { |
| 3859 | return; |
| 3860 | } |
| 3861 | |
| 3862 | /** |
| 3863 | * For monitors, since these are upgraded with "connector" field, |
| 3864 | * which we delete on disable. Beefore we delete this field, we want |
| 3865 | * a copy on connector (and index) to restore space to monitor. |
| 3866 | */ |
| 3867 | if (spaces?.monitors) { |
| 3868 | for (let [monitor, space] of spaces.monitors) { |
| 3869 | this.prevMonitors.set(monitor.connector, space.index); |
| 3870 | } |
| 3871 | } |
| 3872 | |
| 3873 | // store space targetx values |
| 3874 | this.prevTargetX = new Map(); |
| 3875 | spaces.forEach(s => { |
| 3876 | if (s.getWindows().length > 0 && s.targetX !== 0) { |
| 3877 | this.prevTargetX.set(s.uuid, s.targetX); |
| 3878 | } |
| 3879 | }); |
| 3880 | |
| 3881 | // save spaces (for window restore) |
| 3882 | this.prevSpaces = new Map(spaces); |
| 3883 | } |
| 3884 | |
| 3885 | /** |
| 3886 | * Prepares state for restoring on next enable. |
no test coverage detected