diff --git a/keybindings.js b/keybindings.js index 7a396ee6..c1ff536e 100644 --- a/keybindings.js +++ b/keybindings.js @@ -172,6 +172,11 @@ export function setupActions(settings) { registerMinimapAction("switch-up", (mw, space) => space.switchUp()); registerMinimapAction("switch-down", (mw, space) => space.switchDown()); + registerMinimapAction("switch-global-right", (mw, space) => space.switchGlobalRight()); + registerMinimapAction("switch-global-left", (mw, space) => space.switchGlobalLeft()); + registerMinimapAction("switch-global-up", (mw, space) => space.switchGlobalUp()); + registerMinimapAction("switch-global-down", (mw, space) => space.switchGlobalDown()); + registerMinimapAction("move-left", (mw, space) => space.swap(Meta.MotionDirection.LEFT)); registerMinimapAction("move-right", diff --git a/metadata.json b/metadata.json index 0234e4f5..7e26f334 100644 --- a/metadata.json +++ b/metadata.json @@ -5,5 +5,5 @@ "url": "https://github.com/paperwm/PaperWM", "settings-schema": "org.gnome.shell.extensions.paperwm", "shell-version": [ "45" ], - "version-name": "45.7.0" + "version-name": "45.9.2" } diff --git a/navigator.js b/navigator.js index 15319098..8460b86a 100644 --- a/navigator.js +++ b/navigator.js @@ -199,7 +199,7 @@ class ActionDispatcher { } if (!Tiling.inGrab && action.options.opensMinimap) { - nav._showMinimap(space); + nav.showMinimap(space); } action.handler(metaWindow, space, { navigator: this.navigator }); if (space !== Tiling.spaces.selectedSpace) { @@ -286,7 +286,7 @@ class NavigatorClass { this.space.startAnimate(); } - _showMinimap(space) { + showMinimap(space) { let minimap = this.minimaps.get(space); if (!minimap) { let minimapId = GLib.timeout_add(GLib.PRIORITY_DEFAULT, 200, () => { diff --git a/prefsKeybinding.js b/prefsKeybinding.js index 47881ff1..9c4539ee 100644 --- a/prefsKeybinding.js +++ b/prefsKeybinding.js @@ -27,6 +27,10 @@ const actions = { 'switch-right', 'switch-up', 'switch-down', + 'switch-global-left', + 'switch-global-right', + 'switch-global-up', + 'switch-global-down', 'switch-first', 'switch-last', 'live-alt-tab', diff --git a/schemas/gschemas.compiled b/schemas/gschemas.compiled index d42b14fa..5f7b8042 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 e12822f0..ee0cc22a 100644 --- a/schemas/org.gnome.shell.extensions.paperwm.gschema.xml +++ b/schemas/org.gnome.shell.extensions.paperwm.gschema.xml @@ -167,6 +167,23 @@ Switch to the below window + + + Switch to the right window (no monitor boundary) + + + + Switch to the left window (no monitor boundary) + + + + Switch to the above window (no monitor boundary) + + + + Switch to the below window (no monitor boundary) + + Home']]]> Switch to the first window diff --git a/tiling.js b/tiling.js index 12c6f0d1..ea133626 100644 --- a/tiling.js +++ b/tiling.js @@ -1071,6 +1071,84 @@ export class Space extends Array { ensureViewport(metaWindow, space); } + switchGlobalLeft() { this.switchGlobal(Meta.MotionDirection.LEFT); } + switchGlobalRight() { this.switchGlobal(Meta.MotionDirection.RIGHT); } + switchGlobalUp() { this.switchGlobal(Meta.MotionDirection.UP); } + switchGlobalDown() { this.switchGlobal(Meta.MotionDirection.DOWN); } + switchGlobal(direction) { + let space = this; + let index = space.selectedIndex(); + if (index === -1) { + return; + } + let row = space[index].indexOf(space.selectedWindow); + + switch (direction) { + case Meta.MotionDirection.RIGHT: + index++; + break; + case Meta.MotionDirection.LEFT: + index--; + } + if (index < 0 || index >= space.length) { + let monitor = focusMonitor(); + let dir = index < 0 + ? Meta.DisplayDirection.LEFT : Meta.DisplayDirection.RIGHT; + let i = display.get_monitor_neighbor_index(monitor.index, dir); + if (i === -1) + return; + + let newMonitor = Main.layoutManager.monitors[i]; + space = spaces.monitors.get(newMonitor); + if (dir === Meta.DisplayDirection.LEFT) { + index = space.length - 1; + } else { + index = 0; + } + if (space[index].length <= row) + row = space[index].length - 1; + space.activate(false, false); + Navigator.finishNavigation(); + Navigator.getNavigator().showMinimap(space); + } + + let column = space[index]; + if (column.length <= row) + row = column.length - 1; + + switch (direction) { + case Meta.MotionDirection.UP: + row--; + break; + case Meta.MotionDirection.DOWN: + row++; + } + if (row < 0 || row >= column.length) { + let monitor = focusMonitor(); + let dir = row < 0 + ? Meta.DisplayDirection.UP : Meta.DisplayDirection.DOWN; + let i = display.get_monitor_neighbor_index(monitor.index, dir); + if (i === -1) + return; + + let newMonitor = Main.layoutManager.monitors[i]; + space = spaces.monitors.get(newMonitor); + if (space.length <= index) + index = space.length - 1; + if (dir === Meta.DisplayDirection.UP) { + row = space[index].length - 1; + } else { + row = 0; + } + space.activate(false, false); + Navigator.finishNavigation(); + Navigator.getNavigator().showMinimap(space); + } + + let metaWindow = space.getWindow(index, row); + ensureViewport(metaWindow, space); + } + /** * Return the x position of the visible element of this window. */