MCPcopy
hub / github.com/paperwm/PaperWM / init

Method init

tiling.js:384–448  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

382 }
383
384 init() {
385 if (this._populated || Main.layoutManager._startingUp)
386 return;
387
388 let workspace = this.workspace;
389 let prevSpace = saveState.getPrevSpaceByUUID(this.uuid);
390 console.info(`restore by uuid: ${this.uuid}, prevSpace name: ${prevSpace?.name}`);
391
392 // get previous focus mode (if exists)
393 const focusMode = prevSpace?.focusMode;
394 this.addAll(prevSpace);
395 saveState.prevSpaces.delete(workspace);
396 this._populated = true;
397
398 // init window position bar and space topbar elements
399 this.windowPositionBarBackdrop.height = Topbar.panelBox.height;
400 this.setSpaceTopbarElementsVisible();
401
402 // restore focus mode (or fallback to default)
403 setFocusMode(focusMode ?? getDefaultFocusMode(), this);
404
405 this.getWindows().forEach(w => {
406 animateWindow(w);
407 });
408
409 this.layout(false);
410
411 this.signals.connect(workspace, "window-added", (ws, metawindow) => add_handler(ws, metawindow));
412 this.signals.connect(workspace, "window-removed", (ws, metawindow) => remove_handler(ws, metawindow));
413 this.signals.connect(Main.overview, 'showing', this.startAnimate.bind(this));
414 this.signals.connect(Main.overview, 'hidden', () => {
415 if (!spaces.isActiveSpace(this)) {
416 return;
417 }
418
419 // check if after hiding the mouse is on another monitor
420 const monitor = Utils.monitorAtCurrentPoint();
421 const space = spaces.monitors.get(monitor);
422
423 // if space is different, activate that one
424 if (this !== space) {
425 space?.activateWithFocus(space?.selectedWindow, false, false);
426 }
427
428 Utils.later_add(Meta.LaterType.IDLE, () => {
429 space.moveDone(() => {
430 ensureViewport(display.focus_window, this, {
431 moveto: true,
432 force: true,
433 ensureAnimation: Settings.prefs.overview_ensure_viewport_animation,
434 });
435 });
436 });
437 });
438
439 this.signals.connect(gsettings, 'changed::default-focus-mode', () => {
440 setFocusMode(getDefaultFocusMode(), this);
441 });

Callers 4

constructorMethod · 0.95
initWorkspacesFunction · 0.45
initMethod · 0.45
constructorMethod · 0.45

Calls 15

addAllMethod · 0.95
getWindowsMethod · 0.95
layoutMethod · 0.95
setFocusModeFunction · 0.85
getDefaultFocusModeFunction · 0.85
animateWindowFunction · 0.85
add_handlerFunction · 0.85
remove_handlerFunction · 0.85
ensureViewportFunction · 0.85
getPrevSpaceByUUIDMethod · 0.80
connectMethod · 0.80

Tested by

no test coverage detected