diff --git a/.eslintrc.yml b/.eslintrc.yml index dd9dc87f..4b09897a 100644 --- a/.eslintrc.yml +++ b/.eslintrc.yml @@ -7,8 +7,8 @@ env: es2021: true extends: 'eslint:recommended' - #plugins: - # - jsdoc +# plugins: +# - jsdoc rules: array-bracket-newline: - error @@ -66,20 +66,21 @@ rules: - 'CallExpression[callee.object.name=GObject][callee.property.name=registerClass] > ClassExpression:first-child' # Allow dedenting chained member expressions MemberExpression: 'off' - jsdoc/check-alignment: error - jsdoc/check-param-names: error - jsdoc/check-tag-names: error - jsdoc/check-types: error - jsdoc/implements-on-classes: error - jsdoc/tag-lines: - - error - - any - - startLines: 1 - jsdoc/require-jsdoc: error - jsdoc/require-param: error - jsdoc/require-param-description: error - jsdoc/require-param-name: error - jsdoc/require-param-type: error + # # disabling jsdoc while as plugin jsdoc is disabled (have always had issues with plugin) + # jsdoc/check-alignment: error + # jsdoc/check-param-names: error + # jsdoc/check-tag-names: error + # jsdoc/check-types: error + # jsdoc/implements-on-classes: error + # jsdoc/tag-lines: + # - error + # - any + # - startLines: 1 + # jsdoc/require-jsdoc: error + # jsdoc/require-param: error + # jsdoc/require-param-description: error + # jsdoc/require-param-name: error + # jsdoc/require-param-type: error key-spacing: - error - beforeColon: false @@ -259,6 +260,7 @@ globals: ARGV: readonly Debugger: readonly GIRepositoryGType: readonly + global: readonly globalThis: readonly imports: readonly Intl: readonly diff --git a/liveAltTab.js b/liveAltTab.js index cf8d813a..d7987fe1 100644 --- a/liveAltTab.js +++ b/liveAltTab.js @@ -6,13 +6,13 @@ import GObject from 'gi://GObject'; import * as Main from 'resource:///org/gnome/shell/ui/main.js'; import * as AltTab from 'resource:///org/gnome/shell/ui/altTab.js'; -import { Settings, Keybindings, Tiling, Scratch } from './imports.js'; +import { Utils, Settings, Keybindings, Tiling, Scratch } from './imports.js'; import { Easer } from './utils.js'; let switcherSettings; export function enable() { switcherSettings = new Gio.Settings({ - schema_id: 'org.gnome.shell.window-switcher', + schema_id: 'org.gnome.shell.app-switcher', }); } @@ -20,12 +20,12 @@ export function disable() { switcherSettings = null; } -export function liveAltTab(meta_window, space, { display, screen, binding }) { +export function liveAltTab(meta_window, space, { _display, _screen, binding }) { let tabPopup = new LiveAltTab(binding.is_reversed(), false); tabPopup.show(binding.is_reversed(), binding.get_name(), binding.get_mask()); } -export function liveAltTabScratch(meta_window, space, { display, screen, binding }) { +export function liveAltTabScratch(meta_window, space, { _display, _screen, binding }) { let tabPopup = new LiveAltTab(binding.is_reversed(), true); tabPopup.show(binding.is_reversed(), binding.get_name(), binding.get_mask()); } @@ -154,6 +154,7 @@ export const LiveAltTab = GObject.registerClass( // accepted. This can cause _select to run on the item below the pointer // ensuring the wrong window. if (!this.was_accepted) { + // eslint-disable-next-line prefer-rest-params super._itemEnteredHandler.apply(this, arguments); } } diff --git a/tiling.js b/tiling.js index 3501a134..f2203bb0 100644 --- a/tiling.js +++ b/tiling.js @@ -4227,6 +4227,12 @@ export function focus_handler(metaWindow) { } let space = spaces.spaceOfWindow(metaWindow); + + // if window is on another monitor then warp pointer there + if (Utils.monitorAtCurrentPoint() !== space.monitor) { + Utils.warpPointerToMonitor(space.monitor); + } + if (metaWindow.fullscreen) { space.enableWindowPositionBar(false); space.setSpaceTopbarElementsVisible(false); diff --git a/utils.js b/utils.js index 5bb8eb5a..69e8a382 100644 --- a/utils.js +++ b/utils.js @@ -215,26 +215,31 @@ export function monitorAtPoint(gx, gy) { * Returns the monitor current pointer coordinates. */ export function monitorAtCurrentPoint() { - let [gx, gy, $] = getPointerCoords(); + let [gx, gy] = getPointerCoords(); return monitorAtPoint(gx, gy); } /** * Warps pointer to the center of a monitor. */ -export function warpPointerToMonitor(monitor, center = false) { +export function warpPointerToMonitor(monitor, params = { center: false, ripple: true }) { + const center = params?.center ?? false; + const ripple = params?.ripple ?? true; + // no need to warp if already on this monitor let currMonitor = monitorAtCurrentPoint(); if (currMonitor === monitor) { return; } - let [x, y, _mods] = global.get_pointer(); + let [x, y] = global.get_pointer(); if (center) { x -= monitor.x; y -= monitor.y; - warpPointer(monitor.x + Math.floor(monitor.width / 2), - monitor.y + Math.floor(monitor.height / 2)); + warpPointer( + monitor.x + Math.floor(monitor.width / 2), + monitor.y + Math.floor(monitor.height / 2), + ripple); return; } @@ -242,7 +247,8 @@ export function warpPointerToMonitor(monitor, center = false) { let proportionalY = (y - currMonitor.y) / currMonitor.height; warpPointer( monitor.x + Math.floor(proportionalX * monitor.width), - monitor.y + Math.floor(proportionalY * monitor.height) + monitor.y + Math.floor(proportionalY * monitor.height), + ripple ); } @@ -262,7 +268,7 @@ export function warpPointer(x, y, ripple = true) { * Return current modifiers state (or'ed Clutter.ModifierType.*) */ export function getModiferState() { - let [x, y, mods] = global.get_pointer(); + let [, , mods] = global.get_pointer(); return mods; } @@ -294,6 +300,7 @@ export function mkFmt({ nameOnly } = { nameOnly: false }) { const extraStr = extra.join(" | "); let actorId = ""; if (nameOnly) { + // eslint-disable-next-line no-nested-ternary, eqeqeq actorId = actor.name ? actor.name : prefix.length == 0 ? "" : "#"; } else { actorId = actor.toString(); @@ -379,14 +386,7 @@ export function actor_reparent(actor, newParent) { * Backwards compatible later_add function. */ export function later_add(...args) { - // Gnome 44+ uses global.compositor.get_laters() - if (global.compositor?.get_laters) { - global.compositor.get_laters().add(...args); - } - // Gnome 42, 43 used Meta.later_add - else if (Meta.later_add) { - Meta.later_add(...args); - } + global.compositor.get_laters().add(...args); } /** @@ -563,10 +563,10 @@ export class DisplayConfig { return; } - const [serial, monitors, logicalMonitors] = state; + const [, monitors] = state; for (const monitor of monitors) { - const [specs, modes, props] = monitor; - const [connector, vendor, product, serial] = specs; + const [specs] = monitor; + const [connector] = specs; // upgrade gnome monitor object to add connector let gnomeIndex = this.monitorManager.get_monitor_for_connector(connector);