(metaWindow, expelWindow)
| 5315 | * @returns |
| 5316 | */ |
| 5317 | export function barf(metaWindow, expelWindow) { |
| 5318 | if (!metaWindow) |
| 5319 | return; |
| 5320 | |
| 5321 | const space = spaces.spaceOfWindow(metaWindow); |
| 5322 | const index = space.indexOf(metaWindow); |
| 5323 | if (index === -1) |
| 5324 | return; |
| 5325 | |
| 5326 | const column = space[index]; |
| 5327 | if (column.length < 2) |
| 5328 | return; |
| 5329 | |
| 5330 | let to; |
| 5331 | const direction = Settings.prefs.open_window_position; |
| 5332 | switch (direction) { |
| 5333 | case Settings.OpenWindowPositions.LEFT: |
| 5334 | case Settings.OpenWindowPositions.START: |
| 5335 | to = index; // if left then current index will increment |
| 5336 | break; |
| 5337 | case Settings.OpenWindowPositions.RIGHT: |
| 5338 | case Settings.OpenWindowPositions.END: |
| 5339 | default: |
| 5340 | to = index + 1; |
| 5341 | break; |
| 5342 | } |
| 5343 | |
| 5344 | // // remove metawindow from column |
| 5345 | if (expelWindow) { |
| 5346 | // remove expelWindow from current column |
| 5347 | const indexOfWindow = column.indexOf(expelWindow); |
| 5348 | column.splice(indexOfWindow, 1); |
| 5349 | } |
| 5350 | else { |
| 5351 | // remove from bottom |
| 5352 | expelWindow = column.splice(-1, 1)[0]; |
| 5353 | } |
| 5354 | space.splice(to, 0, [expelWindow]); |
| 5355 | |
| 5356 | space.layout(true, { |
| 5357 | customAllocators: { [space.indexOf(metaWindow)]: allocateEqualHeight, ensure: false }, |
| 5358 | }); |
| 5359 | } |
| 5360 | |
| 5361 | export function selectPreviousSpace(_mw, _space) { |
| 5362 | spaces.selectStackSpace(Meta.MotionDirection.DOWN); |
no test coverage detected