Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

window_switcher plugin throws ValueError if there is Google Chrome Picture-in-Picture window open #967

Closed
andreiple opened this issue Dec 29, 2020 · 4 comments
Labels
Stale Stale issue, closing soon.

Comments

@andreiple
Copy link

Source

Additional info

Albert report output Ubuntu 20.04.1 LTS \n \l 5.4.0-58-generic GNOME_DESKTOP_SESSION_ID=this-is-deprecated DESKTOP_SESSION=ubuntu XDG_SESSION_DESKTOP=ubuntu XDG_SESSION_TYPE=x11 XDG_CURRENT_DESKTOP=ubuntu:GNOME GIO_LAUNCHED_DESKTOP_FILE_PID=3101706 qmake-qt5: command not found albert 0.17.2
QtDiag output Command 'qdiag' not found
Terminal output (stdout and stderr) 18:26:17 [warn:python.modulev1] [window_switcher] ValueError: not enough values to unpack (expected 2, got 1)

At:
/usr/share/albert/org.albert.extension.python/modules/window_switcher/init.py(28): handleQuery
.
18:26:17 [warn:python.modulev1] [window_switcher] ValueError: not enough values to unpack (expected 2, got 1)

At:
/usr/share/albert/org.albert.extension.python/modules/window_switcher/init.py(28): handleQuery
.
18:26:17 [warn:python.modulev1] [window_switcher] ValueError: not enough values to unpack (expected 2, got 1)

At:
/usr/share/albert/org.albert.extension.python/modules/window_switcher/init.py(28): handleQuery
.
18:26:17 [warn:python.modulev1] [window_switcher] ValueError: not enough values to unpack (expected 2, got 1)

At:
/usr/share/albert/org.albert.extension.python/modules/window_switcher/init.py(28): handleQuery
.
18:26:18 [warn:python.modulev1] [window_switcher] ValueError: not enough values to unpack (expected 2, got 1)

At:
/usr/share/albert/org.albert.extension.python/modules/window_switcher/init.py(28): handleQuery
.
18:26:18 [warn:python.modulev1] [window_switcher] ValueError: not enough values to unpack (expected 2, got 1)

At:
/usr/share/albert/org.albert.extension.python/modules/window_switcher/init.py(28): handleQuery
.

Steps to reproduce

  1. Make sure Albert's window switcher plugin enabled
  2. Install Picture-in-Picture extension for Google Chrome
  3. In Google Chrome go to Youtube and start playing some video
  4. Click on P-i-P extension button to open the playing video in P-i-P window
  5. Open albert launche and start typing "chrome"

Expected behaviour

Search results should return open Google Chrome window(s)

Actual behaviour

Albert doesn't return a list of matching open windows, but rather throws ValueError in the logs, see attached Terminal output above. Probably that happens due to "N/A" window class returned by wmctrl, e.g.

0x03600007 1 google-chrome.Google-chrome andrei-vm YouTube - Google Chrome
0x03000007 0 tilix.Tilix andrei-vm 1: ~
0x03600325 1 N/A andrei-vm Picture-in-picture

@ManuelSchneid3r
Copy link
Member

Please mention the author of the extension

@andreiple
Copy link
Author

@dshoreman FYI

@dshoreman
Copy link
Contributor

dshoreman commented Dec 30, 2020 via email

@stale
Copy link

stale bot commented Mar 30, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the Stale Stale issue, closing soon. label Mar 30, 2021
saierd added a commit to saierd/albert-python that referenced this issue Apr 5, 2021
Closes albertlauncher/albert#967.

Usually the WM_CLASS printed by wmctrl has two parts (instance and class
name), separated by a dot. There are cases where this is not true:

* Chrome's picture-in-picture window shows a WM_CLASS of N/A (see
  albertlauncher/albert#967).
* Nautilus / Gnome Files on Ubuntu 20.04 shows a WM_CLASS value of
  'org.gnome.Nautilus.Org.gnome.Nautilus', indicating the instance name
  'org.gnome.Nautilus' with the class 'Org.gnome.Nautilus'.

Both cases previously lead to a ValueError due to the unexpected number
of parts after the split.

We now handle the second case by splitting the list of dot-separated
parts in the middle, assuming both pieces have the same number of parts.
As a fallback, we use the whole WM_CLASS as the instance name, which
should also cover the case of the Chrome window.
@stale stale bot closed this as completed Apr 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Stale Stale issue, closing soon.
Development

Successfully merging a pull request may close this issue.

3 participants