mirror of
https://github.com/gosticks/PaperWM.git
synced 2026-06-28 21:20:06 +00:00
cycleWindowWidth: Remember and prefer the originial position
This commit is contained in:
@@ -152,7 +152,7 @@ function init() {
|
||||
dynamic_function_ref("setDevGlobals",
|
||||
Utils));
|
||||
|
||||
registerPaperAction("cycle-width",
|
||||
registerNavigatorAction("cycle-width",
|
||||
dynamic_function_ref("cycleWindowWidth",
|
||||
Tiling),
|
||||
Meta.KeyBindingFlags.PER_WINDOW);
|
||||
|
||||
16
tiling.js
16
tiling.js
@@ -2580,12 +2580,11 @@ function toggleMaximizeHorizontally(metaWindow) {
|
||||
}
|
||||
}
|
||||
|
||||
function cycleWindowWidth(metaWindow) {
|
||||
function cycleWindowWidth(metaWindow, space, {context} = {}) {
|
||||
let steps = prefs.cycle_width_steps;
|
||||
|
||||
let frame = metaWindow.get_frame_rect();
|
||||
let monitor = Main.layoutManager.monitors[metaWindow.get_monitor()];
|
||||
let space = spaces.spaceOfWindow(metaWindow);
|
||||
let workArea = space.workArea();
|
||||
workArea.x += space.monitor.x;
|
||||
|
||||
@@ -2605,6 +2604,19 @@ function cycleWindowWidth(metaWindow) {
|
||||
// Move the window so it remains fully visible
|
||||
targetX = workArea.x + workArea.width - minimumMargin() - targetWidth;
|
||||
}
|
||||
} else {
|
||||
context.targetX = context.targetX || space.targetX;
|
||||
if (space.targetX + space.cloneContainer.width === space.width) {
|
||||
space.targetX -= targetWidth - frame.width;
|
||||
} else {
|
||||
// Prefer the original position
|
||||
space.targetX = context.targetX;
|
||||
}
|
||||
Tweener.addTween(space.cloneContainer,
|
||||
{ x: space.targetX,
|
||||
time: prefs.animation_time,
|
||||
onComplete: space.moveDone.bind(space)
|
||||
});
|
||||
}
|
||||
|
||||
if (metaWindow.get_maximized() === Meta.MaximizeFlags.BOTH) {
|
||||
|
||||
Reference in New Issue
Block a user