[window_switcher] Fix WM_CLASS with an unexpected number of parts #116
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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:
window_switcher plugin throws ValueError if there is Google Chrome Picture-in-Picture window open albert#967).
'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.