()
| 2203 | } |
| 2204 | |
| 2205 | init() { |
| 2206 | // Create extra workspaces if required |
| 2207 | Main.wm._workspaceTracker._checkWorkspaces(); |
| 2208 | |
| 2209 | // Monitors aren't set up properly on `enable`, so we need it enable here. |
| 2210 | this.monitorsChanged(); |
| 2211 | this.signals.connect(Main.layoutManager, 'monitors-changed', () => { |
| 2212 | displayConfig.upgradeGnomeMonitors(() => this.monitorsChanged()); |
| 2213 | }); |
| 2214 | |
| 2215 | this.signals.connect(display, 'window-created', |
| 2216 | (display, metaWindow, _user_data) => this.window_created(metaWindow)); |
| 2217 | |
| 2218 | this.signals.connect(display, 'grab-op-begin', (display, mw, type) => grabBegin(mw, type)); |
| 2219 | this.signals.connect(display, 'grab-op-end', (display, mw, type) => grabEnd(mw, type)); |
| 2220 | |
| 2221 | |
| 2222 | this.signals.connect(global.window_manager, 'switch-workspace', |
| 2223 | (wm, from, to, _direction) => this.switchWorkspace(wm, from, to)); |
| 2224 | |
| 2225 | this.signals.connect(this.overrideSettings, 'changed::workspaces-only-on-primary', () => { |
| 2226 | displayConfig.upgradeGnomeMonitors(() => this.monitorsChanged()); |
| 2227 | }); |
| 2228 | |
| 2229 | // Clone and hook up existing windows |
| 2230 | display.get_tab_list(Meta.TabList.NORMAL_ALL, null) |
| 2231 | .forEach(w => { |
| 2232 | // remove flags |
| 2233 | removePaperWMFlags(w); |
| 2234 | |
| 2235 | registerWindow(w); |
| 2236 | // Fixup allocations on reload |
| 2237 | allocateClone(w); |
| 2238 | addResizeHandler(w); |
| 2239 | addPositionHandler(w); |
| 2240 | }); |
| 2241 | this._initDone = true; |
| 2242 | |
| 2243 | // Initialize spaces _after_ monitors are set up |
| 2244 | this.forEach(space => space.init()); |
| 2245 | |
| 2246 | // Bind to visible workspace when starting up |
| 2247 | this.touchSignal = signals.connect(Main.panel, "touch-event", Gestures.horizontalTouchScroll.bind(this.activeSpace)); |
| 2248 | |
| 2249 | this.stack = this.mru(); |
| 2250 | } |
| 2251 | |
| 2252 | /** |
| 2253 | The monitors-changed signal can trigger _many_ times when |
nothing calls this directly
no test coverage detected