diff --git a/keybindings.js b/keybindings.js index 8b182262..24d5d8b5 100644 --- a/keybindings.js +++ b/keybindings.js @@ -189,6 +189,9 @@ export function setupActions(settings) { registerMinimapAction("switch-up-loop", (mw, space) => space.switchUp(true)); registerMinimapAction("switch-down-loop", (mw, space) => space.switchDown(true)); + registerNavigatorAction("switch-up-or-else-workspace", Tiling.switchUpOrElseWorkspace); + registerNavigatorAction("switch-down-or-else-workspace", Tiling.switchDownOrElseWorkspace); + registerMinimapAction("switch-first", Tiling.activateFirstWindow); registerMinimapAction("switch-last", Tiling.activateLastWindow); diff --git a/prefsKeybinding.js b/prefsKeybinding.js index d6f9c9bb..61728171 100644 --- a/prefsKeybinding.js +++ b/prefsKeybinding.js @@ -37,6 +37,8 @@ const actions = { 'switch-global-right', 'switch-global-up', 'switch-global-down', + 'switch-up-or-else-workspace', + 'switch-down-or-else-workspace', 'switch-first', 'switch-last', 'live-alt-tab', diff --git a/schemas/gschemas.compiled b/schemas/gschemas.compiled index 54a69b2f..2d386926 100644 Binary files a/schemas/gschemas.compiled and b/schemas/gschemas.compiled differ diff --git a/schemas/org.gnome.shell.extensions.paperwm.gschema.xml b/schemas/org.gnome.shell.extensions.paperwm.gschema.xml index 1f835488..9001ba80 100644 --- a/schemas/org.gnome.shell.extensions.paperwm.gschema.xml +++ b/schemas/org.gnome.shell.extensions.paperwm.gschema.xml @@ -198,45 +198,53 @@ - + Switch to the next window (with wrap-around) - + Switch to the previous window (with wrap-around) - + Switch to the right window (with wrap-around) - + Switch to the left window (with wrap-around) - + Switch to the window above (with wrap-around) - + Switch to the window below (with wrap-around) - Switch to the right window (no monitor boundary) + Switch to window or monitor to the right - Switch to the left window (no monitor boundary) + Switch to window or monitor to the left - Switch to the above window (no monitor boundary) + Switch to window or monitor above - Switch to the below window (no monitor boundary) + Switch to window or monitor below + + + + Switch window or workspace above + + + + Switch to window or workspace below diff --git a/tiling.js b/tiling.js index 9e0150bf..7f7575db 100644 --- a/tiling.js +++ b/tiling.js @@ -1058,15 +1058,15 @@ export class Space extends Array { return true; } - switchLeft(loop) { this.switch(Meta.MotionDirection.LEFT, loop); } - switchRight(loop) { this.switch(Meta.MotionDirection.RIGHT, loop); } - switchUp(loop) { this.switch(Meta.MotionDirection.UP, loop); } - switchDown(loop) { this.switch(Meta.MotionDirection.DOWN, loop); } + switchLeft(loop) { return this.switch(Meta.MotionDirection.LEFT, loop); } + switchRight(loop) { return this.switch(Meta.MotionDirection.RIGHT, loop); } + switchUp(loop) { return this.switch(Meta.MotionDirection.UP, loop); } + switchDown(loop) { return this.switch(Meta.MotionDirection.DOWN, loop); } switch(direction, loop) { let space = this; let index = space.selectedIndex(); if (index === -1) { - return; + return false; } let row = space[index].indexOf(space.selectedWindow); switch (direction) { @@ -1085,7 +1085,7 @@ export class Space extends Array { index = 0; } } else if (index < 0 || index >= space.length) { - return; + return false; } let column = space[index]; @@ -1110,11 +1110,13 @@ export class Space extends Array { row = 0; } } else if (row < 0 || row >= column.length) { - return; + return false; } let metaWindow = space.getWindow(index, row); ensureViewport(metaWindow, space); + + return true; } switchGlobalLeft() { this.switchGlobal(Meta.MotionDirection.LEFT); } @@ -4951,6 +4953,16 @@ export function selectUpSpace(mw, space, fromAllMonitors) { spaces.selectSequenceSpace(Meta.MotionDirection.UP, false, fromAllMonitors); } +export function switchDownOrElseWorkspace(mw, space) { + if (!space.switchDown(false)) + selectDownSpace(mw, space, false); +} + +export function switchUpOrElseWorkspace(mw, space) { + if (!space.switchUp(false)) + selectUpSpace(mw, space, false); +} + export function moveDownSpace(_mw, _space) { spaces.selectSequenceSpace(Meta.MotionDirection.DOWN, true); }