paperwm / PaperWM

Tiled scrollable window management for Gnome Shell

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Switching windows with shortcuts `Super+h/l` leads to an automatic infinitive keypressing of `h/l`

lost-melody opened this issue · comments

Describe the bug
When I press Super+l and switch to the right of the current, the target window gets focused and receives infinitive keypressing of l. It happens only to a few applications (e.g., kitty terminal with x11 backend, goldendict).

To Reproduce

  1. Run kitty terminal in wayland by: kitty -c NONE -o linux_display_server=x11.
  2. Switch left or right to kitty's window by Super+h/l.
  3. Release h/l while holding Super, and kitty will receives infinitive h/l until Super is released and h/l is pressed again in kitty.

Expected behavior
The target window should not receive infinitive keypressing.

Screenshots
image

System information:

Distribution: Arch Linux
GNOME Shell 46.0
Display server: Wayland
PaperWM branch/tag: develop
PaperWM commit: 33881025b8804ba22459c657239035d69a0ec4f3
Enabled extensions:
- appindicatorsupport@rgcjonas.gmail.com
- user-theme@gnome-shell-extensions.gcampax.github.com
- Bluetooth-Battery-Meter@maniacx.github.com
- AlphabeticalAppGrid@stuarthayhurst
- kimpanel@kde.org
- runcat@kolesnikov.se
- blur-my-shell@aunetx
- gnome-ui-tune@itstime.tech
- unite@hardpixel.eu
- paperwm@paperwm.github.com

Additional context

  1. It seems that it only happens to xwayland backend windows, but I'm not 100% sure.
  2. I believe it's not PaperWM's fault, but I wonder if there could be some solutions.

Currently my workaround for this problem is to comment out this line in file tiling.js, function updateSelection:

    // ensure window is properly activated (if not activated)
    if (space === spaces.activeSpace) {
        if (metaWindow !== display.focus_window) {
            // Main.activateWindow(metaWindow);
        }
    }

This is not an elegant solution since it disables window focus during switching, which makes the window gray through all the switching process.
I suggest that the selected window should be highlighted just like that in Live Alt Tab, but I'm afraid I cannot figure it out.

Hey @lost-melody, yes, this is Gnome 46 bug that I'm been trying to debug for quite a while now with no resolution as yet. See #799 (comment)

Currently my workaround for this problem is to comment out this line in file tiling.js, function updateSelection:

Additional context

  1. It seems that it only happens to xwayland backend windows, but I'm not 100% sure.
  2. I believe it's not PaperWM's fault, but I wonder if there could be some solutions.

Currently my workaround for this problem is to comment out this line in file tiling.js, function updateSelection:

Great insights! I've been focusing on pushModal, popModal as I thought it was key focus - but no matter what Gnome now seems to leak key events to some windows. I'm asked re if anyone else is seeing this on the Gnome-extensions Matrix channel and got radio silence.

Appreciate if anyone can also look at this as the more eyes on this the more likely we'll come up with a workaround. Surprised other extensions aren't seeing this.

Note: this issue is currently stopping Gnome-46 compatibility (and hence why I haven't updated the extension officially).

Currently my workaround for this problem is to comment out this line in file tiling.js, function updateSelection:

    // ensure window is properly activated (if not activated)
    if (space === spaces.activeSpace) {
        if (metaWindow !== display.focus_window) {
            // Main.activateWindow(metaWindow);
        }
    }

Ah! again, great find, this explains losing keybind focus during switching! I couldn't find what was triggerign pushModal to lose keybind focus and leak keybinds, but this appears to be it (which makes sense this we're activating windows during switching in the minimap). Navigating with minimap grab keybind focus and this is breaking that - something has changed from Gnome 45 though as this behaviour is new.

In any case, disabling the above and instead using highlight during navigation is a good idea.

Hey @lost-melody,

Can you please test branch gnome-46?

I'm still experimenting with simple opacity. Highlighting (like in altab) is a little more involved since gnome alttab hasn't exported the classes so we'd need to create our own.

If opacity works well enough, we could make the opacity setting a user preference.

Note, the opacity setting on windows is bound to the minimap (i.e. will be enforced when minimap is shown).

although.. I think I like the dimming from alt-tab better. Will look at implementing this.

P.S. I've now implemented a simple dimming/shade effect for windows when minimap is open.

Hey @lost-melody,
Can you please test branch gnome-46?

Sure, I've tested it and it was awesome! Switching between windows and between workspaces works really fine.

What I've found that could be improved is that when I press Super+T to take a window, the minimap doesn't show and therefore the dimming/shade effect is not applied.

Also, probably not related to this issue, I found that when I take a window by Super+T, lags happen to the other windows' moving animations. And there are lots of failed assertions in journalctl -f /usr/bin/gnome-shell on press and on release:

gnome-shell[1289]: invalid (NULL) pointer instance
gnome-shell[1289]: g_signal_handler_disconnect: assertion 'G_TYPE_CHECK_INSTANCE (instance)' failed