Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[window_switcher] Fix WM_CLASS with an unexpected number of parts
Closes alberlauncher/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 alberlauncher/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.
- Loading branch information