Skip to content

Conversation

@cnharrison
Copy link
Contributor

Summary

  • fix the bug where enabling “Move pointer with the focus” causes workspace switches to highlight the window on a monitor whose workspace didn’t change
  • reuse the pointer’s monitor/workspace when rebuilding the tree so focus returns to the monitor that actually switched workspaces
  • after the workspace switch completes, refocus and warp the pointer back to that monitor so it stays active

Behavior Change

  • Before: switching workspaces with pointer warp enabled caused Mutter to revive a static window on another monitor, Forge warped the pointer there, and focus jumped away from the monitor whose workspace you actually changed.
  • After: Forge remembers which monitor the pointer belonged to, reorders its window list for that monitor, and re-applies focus (plus pointer warp) back to that monitor when the workspace switch finishes.

Impact

  • Multi-monitor users with pointer warping enabled keep focus on the monitor whose workspace they switched to, instead of having it jump to a static secondary display.

Testing

  • GNOME 46.3 (Wayland)
  • move-pointer-focus-enabled=true
  • Switching workspaces keeps focus/pointer on the monitor associated with the new workspace; other monitors no longer steal focus.

- track the monitor/workspace of the last focused window whenever the pointer is warped
- after an active-workspace change, refocus the tiled window on the pointer's monitor instead of leaving focus on an unrelated display
- sort pointer-tracking windows by stacking order so keyboard navigation still works when the pointer stays put
@cnharrison cnharrison marked this pull request as ready for review October 10, 2025 02:51
@juarezr
Copy link
Contributor

juarezr commented Oct 12, 2025

It looks like the GH actions failure is due to source code formatting issues:

❯ nvm use latest
Now using Node v24.7.0 (npm 11.5.1) ~/.local/share/nvm/v24.7.0/bin/node
❯ npm test --verbose
npm verbose cli /home/juarezr/.local/share/nvm/v24.7.0/bin/node /home/juarezr/.local/share/nvm/v24.7.0/bin/npm
npm info using npm@11.5.1
npm info using node@v24.7.0
npm verbose title npm test
npm verbose argv "test" "--loglevel" "verbose"
npm verbose logfile logs-max:10 dir:/home/juarezr/.npm/_logs/2025-10-12T19_12_50_039Z-
npm verbose logfile /home/juarezr/.npm/_logs/2025-10-12T19_12_50_039Z-debug-0.log

> forge@22.51.0 test
> prettier --list-different "./**/*.{js,jsx,ts,tsx,json}"

lib/extension/window.js
lib/prefs/metadata.js
npm verbose cwd /home/juarezr/src/gnome/forge
npm verbose os Linux 6.14.0-33-generic
npm verbose node v24.7.0
npm verbose npm  v11.5.1
npm verbose exit 1
npm verbose code 1
❯ npm run format

> forge@22.51.0 format
> prettier --write "./**/*.{js,jsx,ts,tsx,json}"

lib/extension/window.js 158ms
lib/prefs/metadata.js 5ms

It looks like prettier doesn't like multiline closures:

diff --git a/lib/extension/window.js b/lib/extension/window.js
index 7323159..30112a3 100644
--- a/lib/extension/window.js
+++ b/lib/extension/window.js
@@ -1928,15 +1928,13 @@ export class WindowManager extends GObject.Object {
       return;
     }
 
-    const candidateNodes = this.tree
-      .getNodeByType(NODE_TYPES.WINDOW)
-      .filter((node) => {
-        if (!node.isTile()) return false;
-        const meta = node.nodeValue;
-        if (!meta || meta.minimized) return false;
-        const metaWorkspace = meta.get_workspace();
-        return meta.get_monitor() === monitor && metaWorkspace && metaWorkspace.index() === workspace;
-      });
+    const candidateNodes = this.tree.getNodeByType(NODE_TYPES.WINDOW).filter((node) => {
+      if (!node.isTile()) return false;
+      const meta = node.nodeValue;
+      if (!meta || meta.minimized) return false;
+      const metaWorkspace = meta.get_workspace();
+      return meta.get_monitor() === monitor && metaWorkspace && metaWorkspace.index() === workspace;
+    });
 
     if (candidateNodes.length === 0) return;

Running npm run format and committing should solve the issue.

Copy link
Contributor

@juarezr juarezr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Running npm run format and committing may solve the issues with source code formatting in the CI/GH Actions workflow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants