MCPcopy Create free account
hub / github.com/bea4dev/ShojiWM / animateWorkspaceTransition

Method animateWorkspaceTransition

packages/config/src/window-manager.ts:3242–3293  ·  view source on GitHub ↗
(options: {
    fromOffsetY: number;
    toOffsetY: number;
    fromOpacity: number;
    toOpacity: number;
    visibleAfter: boolean;
  })

Source from the content-addressed store, hash-verified

3240 this.clearFloatingSnapPreview();
3241 return false;
3242 }
3243 const snap = this.floatingSnap;
3244 this.floatingSnap = null;
3245 if (!snap || snap.windowId !== event.window.id) {
3246 if (snap) {
3247 this.emitSnapPreview(snap.monitor, null, "floating");
3248 }
3249 return false;
3250 }
3251
3252 this.emitSnapPreview(snap.monitor, null, "floating");
3253 if (event.phase !== "end") {
3254 return false;
3255 }
3256
3257 const window = event.window;
3258 const isMaximized = window.state[WINDOW_STATE_MAXIMIZED]();
3259
3260 if (snap.zone === "maximize") {
3261 this.clearWindowSnapState(window);
3262 // Route through the real maximize so the compositor `isMaximized` state
3263 // (and therefore the SSD maximize/restore icon) stays in sync. Calling
3264 // maximize() fires onWindowMaximizeRequest, which applies the rect.
3265 if (!isMaximized) {
3266 window.maximize();
3267 } else {
3268 // Already maximized (e.g. re-dropped on the top edge): just re-apply
3269 // the maximized rect for the monitor under the cursor.
3270 const rect = this.maximizedRectForWindow(window);
3271 playRectAnimation(
3272 window,
3273 WINDOW_STATE_RECT,
3274 rect,
3275 WINDOW_MANAGEMENT_EASING,
3276 WINDOW_MANAGEMENT_ANIMATION_DURATION,
3277 );
3278 workspace?.syncFloatingWindowRect(window, rect);
3279 }
3280 } else {
3281 // Half / quarter: ensure the window is unmaximized first (syncs the SSD
3282 // icon), with the restore rect cleared so unmaximize() does not animate
3283 // back to it and fight the snap, then place it at the zone rect.
3284 if (isMaximized) {
3285 window.state[WINDOW_STATE_RESTORE_RECT].set(null);
3286 window.state[WINDOW_STATE_MAXIMIZED].set(false);
3287 window.unmaximize();
3288 }
3289 playRectAnimation(
3290 window,
3291 WINDOW_STATE_RECT,
3292 snap.rect,
3293 WINDOW_MANAGEMENT_EASING,
3294 WINDOW_MANAGEMENT_ANIMATION_DURATION,
3295 );
3296 this.setWindowSnapState(workspace, window, snap.monitor, snap.zone);

Callers 2

switchWorkspaceToMethod · 0.80

Calls 5

setVisibleMethod · 0.95
setMethod · 0.65

Tested by

no test coverage detected