qutebrowser / qutebrowser

A keyboard-driven, vim-like browser based on Python and Qt.
https://www.qutebrowser.org/
GNU General Public License v3.0
9.76k stars 1.01k forks source link

Qt 6: Alt + number does not switch tabs back and forth #8169

Open Hi-Angel opened 7 months ago

Hi-Angel commented 7 months ago

Version info:

qutebrowser v3.1.0
Git commit:
Backend: QtWebEngine 6.7, based on Chromium 118.0.5993.220 (from api)
Qt: 6.7.0

Does the bug happen if you start with --temp-basedir?: yes

Description

Some time earlier I noticed that I no longer can switch back and forth between two last tabs by pressing Alt with a number of either of them.

I just started digging into it and bisected this down to a number of commits.

Unfortunately these commits apparently haven't been tested, because each one of them either fails or crashes the browser whatsoever. So the code is not bisectable any further than that:

There are only 'skip'ped commits left to test.
The first bad commit could be any of:
236371cb1db6cc2e525a80495602d30845534ec0
75188fb257fe3e9b4d88ef49b53fb8c9e4a82d6e
5e26fa922b21f026d2660f7c2408452ffeba9623
cedca4737003e9f3f153b6df5b51f43dc80f73cc
76f9262defc0217289443467927cab7c211aff73
894acbd6f7e9c47cbaf3824ed96e04e9d0d8c9db
8011eb4b49bc7c586df211c396c8004a787aa494
96c303823f6084266afc52041c1bae26e57140d2
49d840a9233f3b4b6427d4cb26cd454cfd0de189
8031abd5ad27b60cba37298ae56f9838b52c39a5
bcfa99d1e644de260eb3c689f31aeba00d193e89
f0972704a785029568c6ea36b76bad53fd479a6d
3ef3bac01d591c7ff9f86309f0607c9f81b71dca
d734101d9ae2b43ff58769268e5ea7283ec8cfcb
e2537e4ed1a824ce98e35ca9f460cea5135d86d3
fcd1a7bbb1d7d252180738958e914104c5837678
0877fb0d78635692e481c8bde224fac5ad0dd430
aced2c47ae64a490855e7d79486273c56a0a916b
a11f1d34d3784b170fbc3f5a0e04d5c96ab06b74
fce306d5f184f185b660f35ec2808b6745d57520
3e21c8214a998cb1058defd15aabb24617a76402
5ebfee1f420dabc67fa1e5ee1ddad5b946ddea62
d47cfd99d7374a41b4c228c21221c7850e65d0b1
f6e1235421c0d23656cc0230dbd6640f089f3542
6cac151ad9c6d25085c900eca50a0c391baf0433
f8520b0a768aa8e30904d74e1f0d8d4d79bbd98a
ec8e5af4dd691a2fdb2bfed5bf1e45f2aa57be1e
We cannot bisect more!

How to reproduce

  1. Run ./qutebrowser.py --temp-basedir
  2. Open 2-nd tab
  3. Start pressing Alt+2

Expected

The browser switches between 1-st and 2-nd tab

Actual

The browser switches to 2nd tab just once, and nothing happens anymore.

Hi-Angel commented 7 months ago

That's so weird to see the commits being dated by 2022, whereas I'm certain it is not that old, I would say I only noticed it maybe a few months ago or so…

But FTR, I didn't botch the bisection: I repeated it (this time even in a different way: by checking out good/bad commits along the main branch whereas the post was done by using stable branches as good/bad points), and I came to the exact same commits list.

The-Compiler commented 7 months ago

Works fine for me. The bisect is misleading, those commits just reflect you switching from Qt 5 to Qt 6. If you run with --qt-wrapper pyqt5 it will probably work fine on main too.

This might just be a duplicate of #8127 I think, and the breakage was probably introduced by you upgrading to Qt 6.6.2 or maybe Qt 6.7?

Hi-Angel commented 7 months ago

The bisect is misleading, those commits just reflect you switching from Qt 5 to Qt 6. If you run with --qt-wrapper pyqt5 it will probably work fine on main too.

Oh, I confirm, running with a --qt-wrapper PyQt5 fixes the problem!

This might just be a duplicate of #8127 I think

Well, from the description I am not so sure… It seems to be about the default behavior of a keybinding being changed. But you know the code better, so if you think the underlying reason is the same, maybe so.

and the breakage was probably introduced by you upgrading to Qt 6.6.2 or maybe Qt 6.7?

Hmm, it is possible. I'm kind of afraid of downgrading it, something might break… but it does sound plausible, given you've recently fixed another bug that was related to Qt regression as well…

Works fine for me.

What Qt version do you have?

Hi-Angel commented 5 months ago

The problem is fixed after upgrade. Not sure what fixed (QtWebEngine update or the Qutebrowser), so here's the snippet from my current :version:

qutebrowser v3.2.0
Git commit: 
Backend: QtWebEngine 6.7.1
  based on Chromium 118.0.5993.220
  with security patches up to 124.0.6367.202 (plus any distribution patches)
  (source: api)
Qt: 6.7.1
The-Compiler commented 5 months ago

Not sure either! Nothing changed in qutebrowser, and I can't find anything in the Qt 6.7.1 changelog that sounds related. Given that I can't reproduce, maybe the culprit was somewhere else (a theme?) and fixed.

Hi-Angel commented 5 months ago

Actually, I was wrong, the issue still happens but something apparently influences it.

When I closed it I had to use older laptop for some time and I had Wayland KDE there. Now I'm back to the work laptop and after updating the system the problem still there. So it may be due to Wayland difference or something else, I'm not sure…

Cybolic commented 2 months ago

I'm getting a very similar issue on Wayland, where every shortcut that uses the alt key does something else. alt+m switches to tab 1 alt+y (in the download prompt), switches to tab 26 (I can't explain this one) alt+1, alt+2, alt+3 switches to tab 10, 20 and 30, but alt+[4-9] switches to the correct tab.

I haven't changed the bindings for these shortcuts.

Running with --qt-wrapper PyQt5 doesn't work for me as I'm on NixOS, so only the packages applied to qutebrowser during the package build are available.

Version info:

qutebrowser v3.2.1
Git commit: 
Backend: QtWebEngine 6.7.2
  based on Chromium 118.0.5993.220
  with security patches up to 125.0.6422.142 (plus any distribution patches)
  (source: api)
Qt: 6.7.2

CPython: 3.12.5
PyQt: 6.7.0.dev2404081550

Qt wrapper info:
  PyQt6: success
  PyQt5: not imported
  -> selected: PyQt6 (via autoselect)

EDIT: Changing the qutebrowser package to use Qt5, does indeed make the shortcuts work again. Version info:


qutebrowser v3.2.1
Git commit: 
Backend: QtWebEngine 5.15.17
  based on Chromium 87.0.4280.144
  with security patches up to 123.0.6312.58 (plus any distribution patches)
  (source: UA)
Qt: 5.15.14

CPython: 3.12.5
PyQt: 5.15.10

Qt wrapper info:
  PyQt6: ModuleNotFoundError: No module named 'PyQt6'
  PyQt5: success
  -> selected: PyQt5 (via autoselect)

EDIT 2: Seeing as these are Nix packages, you should be able to get a reproducible build by using nixpkgs-unstable (revision 574d1eac1c200690e27b8eb4e24887f8df7ac27c) for Qt6, and the Qt5 build with this setup:

qutebrowser.override {
  qtbase = pkgs.qt5.qtbase;
  qtwayland = pkgs.qt5.qtwayland;
  qtwebengine = pkgs.qt5.qtwebengine;
};