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

Function ensureViewport

tiling.js:4355–4404  ·  view source on GitHub ↗
(meta_window, space, options = {})

Source from the content-addressed store, hash-verified

4353 * @returns
4354 */
4355export function ensureViewport(meta_window, space, options = {}) {
4356 space = space ?? spaces.spaceOfWindow(meta_window);
4357 let force = options?.force ?? false;
4358 let moveto = options?.moveto ?? true;
4359 let animate = options?.animate ?? true;
4360 let ensureAnimation = options.ensureAnimation ?? Settings.EnsureViewportAnimation.TRANSLATE;
4361 let callback = options.callback ?? function () { };
4362
4363 let index = space.indexOf(meta_window);
4364 if (index === -1 || space.length === 0)
4365 return undefined;
4366
4367 if (space.selectedWindow.fullscreen &&
4368 !meta_window.fullscreen) {
4369 animateDown(space.selectedWindow);
4370 }
4371 let x = ensuredX(meta_window, space);
4372
4373 space.selectedWindow = meta_window;
4374 let selected = space.selectedWindow;
4375 if (!inPreview && selected.fullscreen) {
4376 let y = 0;
4377 let ty = selected.clone.get_transition('y');
4378 if (!space.isVisible(selected)) {
4379 selected.clone.y = y;
4380 } else if (!ty || ty.get_interval().final !== y) {
4381 Easer.addEase(selected.clone,
4382 {
4383 y,
4384 time: Settings.prefs.animation_time,
4385 onComplete: space.moveDone.bind(space),
4386 });
4387 }
4388 }
4389
4390 if (moveto) {
4391 move_to(space, meta_window, {
4392 x,
4393 force,
4394 animate,
4395 ensureAnimation,
4396 callback,
4397 });
4398 }
4399
4400 selected.raise();
4401 Utils.actor_raise(selected.clone);
4402 updateSelection(space, meta_window);
4403 space.emit('select');
4404}
4405
4406export function updateSelection(space, metaWindow) {
4407 if (!metaWindow) {

Callers 15

initWorkspacesFunction · 0.85
initMethod · 0.85
layoutMethod · 0.85
removeWindowMethod · 0.85
swapMethod · 0.85
switchLinearMethod · 0.85
switchMethod · 0.85
switchGlobalMethod · 0.85
_driftMethod · 0.85
createBackgroundMethod · 0.85
animateToSpaceMethod · 0.85
insertWindowFunction · 0.85

Calls 8

animateDownFunction · 0.85
ensuredXFunction · 0.85
move_toFunction · 0.85
updateSelectionFunction · 0.85
spaceOfWindowMethod · 0.80
indexOfMethod · 0.80
isVisibleMethod · 0.80
raiseMethod · 0.80

Tested by

no test coverage detected