Skip to content

External monitor loses clicks/focus intermittently on 2-monitor setup — spaceOf() returns undefined #1186

Description

@word5355

Investigation, logs and Looking Glass output are my own from a live occurrence;
I used Claude to help read the source and organise this writeup.

Posting this mainly to check whether others have run into the same thing.

Describe the bug
On a 2-monitor setup (external monitor as GNOME primary, laptop built-in
as secondary), intermittently:

  • Clicks stop registering on the external monitor entirely (even GNOME
    Shell's own Looking Glass overlay doesn't respond there). The top panel
    (clock, battery, etc.) on that same monitor stays clickable throughout —
    only window content (and Looking Glass) fails to receive clicks.
  • Top-bar workspace indicator and the Overview disagree about which
    workspace the visible windows are actually on.
  • Moving a window between workspaces in the Overview sends it to the
    wrong monitor.
  • Super+Shift+<direction> (switch-monitor) does move keyboard focus to
    the external monitor, but the mouse cursor gets warped to a screen
    corner. As soon as the mouse is moved after that, focus snaps back to
    the laptop display.

Only ever observed with two monitors connected; I haven't tried to
reproduce with a single monitor.

To Reproduce
Exact trigger unclear. Seen once right after unplugging/replugging the
external monitor, but also without any recent hotplug. No reliable
repro steps yet.

Expected behavior
Clicking on either monitor should always interact with the window
actually displayed there, and the workspace indicator should match what
the Overview shows.

System information

  • GNOME Shell 50, Wayland
  • PaperWM 50.0.1
  • 2 monitors: external set as primary, laptop built-in as secondary
  • org.gnome.mutter workspaces-only-on-primary = false
  • org.gnome.mutter dynamic-workspaces = true
  • org.gnome.desktop.wm.preferences focus-mode = 'click'

(happy to provide distro/hardware/full extension list if useful)

Additional context

journalctl at the moment of the issue:
​ JS ERROR: TypeError: can't access property "indexOf", space is undefined setupOverrides/<@.../paperwm@paperwm.github.com/patches.js:310:25 _doAddWindow@resource:///org/gnome/shell/ui/workspace.js:1206:19 _windowEnteredMonitor@resource:///org/gnome/shell/ui/workspace.js:1266:18 moveDone/<@.../paperwm@paperwm.github.com/tiling.js:1408:19 ... insertWindow@.../paperwm@paperwm.github.com/tiling.js:4208:15 ​

patches.js:310 is Tiling.spaces.spaceOf(this.metaWorkspace).indexOf(window).
spaceOf() is a plain Map.get(), so at that moment there was no entry in
Tiling.spaces for the workspace GNOME's own _doAddWindow was processing.

Live Looking Glass check during the same occurrence (mouse physically on
the external monitor):
​ pointerMonitor=1 focusMonitor=0 ​
confirming keyboard focus stayed on the laptop's monitor while the pointer
was on the external one.

I tried calling Stackoverlay.disableMultimonitorSupport() from Looking
Glass — it did not stop focus from snapping back on mouse movement, though
I couldn't confirm it stayed disabled at the moment it happened.

Workaround: Super+Shift+<direction> restores focus to the external
monitor, and keyboard-only interaction works fine immediately after —
the issue only recurs once the mouse moves.

A follow-up check of the monitor→space map (Tiling.spaces.monitors)
taken after using the workaround showed it in a normal-looking state
(2 entries, no UNDEF), including while switching workspaces on the
laptop monitor (only that monitor's entry changed, as expected) — so I
wasn't able to capture the map in a visibly broken state.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugUndesirable behavior

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions