This works perfectly to allow matches with the Spotify client. Thanks to Guillaumefor his help and thought I'd share as it might help someone else.
# Work around for matching Spotify import time @hook.subscribe.client_new def slight_delay(window): time.sleep(0.01) On Fri, 18 Dec 2020 at 15:54, Justine Smithies <[email protected]> wrote: > I'll give that a try this evening. When you say it will block Qtile that's > not permanently just for the split second you open a new application. > > On Fri, 18 Dec 2020, 15:14 Guillaume Gelin, <[email protected]> wrote: > >> I didn't do much, just something along these lines to debug Spotify: >> https://gist.github.com/ramnes/2feecfa7aecf7260dd7b65f7cb995c31 >> >> Beware though, the sleep is going to block Qtile. But it should be >> possible to do it asynchronously using Qtile's event loop. It would be even >> better that we support async functions for hooks, but that's not the case >> at the moment. >> >> Le ven. 18 déc. 2020 à 15:28, Justine Smithies <[email protected]> >> a écrit : >> >>> Ok Guillaume could you help me out a little please ? Where did you put >>> the sleep(0.03) command for the matches groups ?? Do you have an example. >>> Once again thanks for your help. >>> >>> Justine >>> >>> On Fri, 18 Dec 2020, 00:31 Guillaume Gelin, <[email protected]> wrote: >>> >>>> Yeah, Spotify seems to be spawned without WM_CLASS nor WM_NAME, I'm not >>>> sure why. It seems to be updated quite fast though, a sleep(0.01) is enough >>>> on my machine to grab the name, and sleep(0.03) for the class. >>>> >>>> Le jeu. 17 déc. 2020 à 19:29, Justine Smithies <[email protected]> >>>> a écrit : >>>> >>>>> Yeah on investigation it seems the official Spotify client gives other >>>>> tiling WM's problems with the WM_CLASS . Oh well will just have to use >>>>> Spitify-tui with Spotifyd . >>>>> >>>>> On Thu, 17 Dec 2020, 17:21 egemen şahin, <[email protected]> >>>>> wrote: >>>>> >>>>>> It is a common problem with spotify I guess. I experienced the same >>>>>> with qtile and other window managers as well. >>>>>> >>>>>> On Thu, 17 Dec 2020, 20:19 Justine Smithies, <[email protected]> >>>>>> wrote: >>>>>> >>>>>>> I have got my group matches working on everything else but I cannot >>>>>>> get spotify to behave. I get no errors but Spotify always opens on the >>>>>>> window that I'm currently working on not number 5. I'm using Arch and >>>>>>> the >>>>>>> master version of Qtile. Can someone take a look at my group code for my >>>>>>> config.py and I'll post the xprop from Spotify too. >>>>>>> >>>>>>> [justine@justine-laptop ~]$ xprop >>>>>>> _NET_WM_ICON(CARDINAL) = >>>>>>> WM_CLASS(STRING) = "spotify", "Spotify" >>>>>>> WM_NAME(STRING) = "Spotify Premium" >>>>>>> _NET_WM_NAME(UTF8_STRING) = "Spotify Premium" >>>>>>> _NET_WM_DESKTOP(CARDINAL) = 0 >>>>>>> WM_STATE(WM_STATE): >>>>>>> window state: Normal >>>>>>> icon window: 0x0 >>>>>>> XdndProxy(WINDOW): window id # 0x1600002 >>>>>>> WM_NORMAL_HINTS(WM_SIZE_HINTS): >>>>>>> program specified location: 0, 0 >>>>>>> window gravity: Static >>>>>>> _NET_WM_PID(CARDINAL) = 33081 >>>>>>> WM_LOCALE_NAME(STRING) = "en_GB.UTF-8" >>>>>>> WM_CLIENT_MACHINE(STRING) = "justine-laptop" >>>>>>> WM_PROTOCOLS(ATOM): protocols WM_DELETE_WINDOW, _NET_WM_PING >>>>>>> >>>>>>> # Groups with matches >>>>>>> >>>>>>> workspaces = [ >>>>>>> {"name": " Home", "key": "1", "matches": >>>>>>> [Match(wm_class='firefox')]}, >>>>>>> {"name": " Dev", "key": "2", "matches": >>>>>>> [Match(wm_class='nemo')]}, >>>>>>> {"name": " Chat", "key": "3", "matches": >>>>>>> [Match(wm_class='telegram-desktop')]}, >>>>>>> {"name": " GFX", "key": "4", "matches": >>>>>>> [Match(wm_class='gimp')]}, >>>>>>> {"name": "阮 Music", "key": "5", "matches": >>>>>>> [Match(wm_class='Spotify')]}, >>>>>>> ] >>>>>>> >>>>>>> groups = [] >>>>>>> for workspace in workspaces: >>>>>>> matches = workspace["matches"] if "matches" in workspace else >>>>>>> None >>>>>>> groups.append(Group(workspace["name"], matches=matches, >>>>>>> layout="monadtall")) >>>>>>> keys.append(Key([mod], workspace["key"], >>>>>>> lazy.group[workspace["name"]].toscreen())) >>>>>>> keys.append(Key([mod, "shift"], workspace["key"], >>>>>>> lazy.window.togroup(workspace["name"]))) >>>>>>> >>>>>>> >>>>>>> Thanks in advance >>>>>>> Justine >>>>>>> >>>>>>> -- >>>>>>> You received this message because you are subscribed to the Google >>>>>>> Groups "qtile-dev" group. >>>>>>> To unsubscribe from this group and stop receiving emails from it, >>>>>>> send an email to [email protected]. >>>>>>> To view this discussion on the web visit >>>>>>> https://groups.google.com/d/msgid/qtile-dev/CADrRWNbFLevObK%2B22xQ%3D%2B3K5wJRxrf29koDeh0cAPCBSRxpN%2BQ%40mail.gmail.com >>>>>>> <https://groups.google.com/d/msgid/qtile-dev/CADrRWNbFLevObK%2B22xQ%3D%2B3K5wJRxrf29koDeh0cAPCBSRxpN%2BQ%40mail.gmail.com?utm_medium=email&utm_source=footer> >>>>>>> . >>>>>>> >>>>>> -- >>>>>> You received this message because you are subscribed to the Google >>>>>> Groups "qtile-dev" group. >>>>>> To unsubscribe from this group and stop receiving emails from it, >>>>>> send an email to [email protected]. >>>>>> To view this discussion on the web visit >>>>>> https://groups.google.com/d/msgid/qtile-dev/CAG4pprO0mouhZfE5SsQ0hhMCGgaNkYXqaK2KwfOnFamQfX3CaQ%40mail.gmail.com >>>>>> <https://groups.google.com/d/msgid/qtile-dev/CAG4pprO0mouhZfE5SsQ0hhMCGgaNkYXqaK2KwfOnFamQfX3CaQ%40mail.gmail.com?utm_medium=email&utm_source=footer> >>>>>> . >>>>>> >>>>> -- >>>>> You received this message because you are subscribed to the Google >>>>> Groups "qtile-dev" group. >>>>> To unsubscribe from this group and stop receiving emails from it, send >>>>> an email to [email protected]. >>>>> To view this discussion on the web visit >>>>> https://groups.google.com/d/msgid/qtile-dev/CADrRWNYs8qHxsXDowHKV_dnu2%2BrB7P5x9D%2B55gMP_xx9ghQ9yQ%40mail.gmail.com >>>>> <https://groups.google.com/d/msgid/qtile-dev/CADrRWNYs8qHxsXDowHKV_dnu2%2BrB7P5x9D%2B55gMP_xx9ghQ9yQ%40mail.gmail.com?utm_medium=email&utm_source=footer> >>>>> . >>>>> >>>> >>>> >>>> -- >>>> Guillaume Gelin >>>> >>>> -- >>>> You received this message because you are subscribed to the Google >>>> Groups "qtile-dev" group. >>>> To unsubscribe from this group and stop receiving emails from it, send >>>> an email to [email protected]. >>>> To view this discussion on the web visit >>>> https://groups.google.com/d/msgid/qtile-dev/CAPn4x%2Brnka_AYMwPeYCHMDGz5SYBTpQCwmfG02jFQvs-rOJqtQ%40mail.gmail.com >>>> <https://groups.google.com/d/msgid/qtile-dev/CAPn4x%2Brnka_AYMwPeYCHMDGz5SYBTpQCwmfG02jFQvs-rOJqtQ%40mail.gmail.com?utm_medium=email&utm_source=footer> >>>> . >>>> >>> -- >>> You received this message because you are subscribed to the Google >>> Groups "qtile-dev" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to [email protected]. >>> To view this discussion on the web visit >>> https://groups.google.com/d/msgid/qtile-dev/CADrRWNZChfMSQOb5WXJpwPXOkUEWFEZY2%3Dcwr9M-Jec7uTL_qQ%40mail.gmail.com >>> <https://groups.google.com/d/msgid/qtile-dev/CADrRWNZChfMSQOb5WXJpwPXOkUEWFEZY2%3Dcwr9M-Jec7uTL_qQ%40mail.gmail.com?utm_medium=email&utm_source=footer> >>> . >>> >> >> >> -- >> Guillaume Gelin >> >> -- >> You received this message because you are subscribed to the Google Groups >> "qtile-dev" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected]. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/qtile-dev/CAPn4x%2Br6n9nud%3Db%2BHNZe2_Se4x1eOH6vorrGNOXaYq06mPh2gA%40mail.gmail.com >> <https://groups.google.com/d/msgid/qtile-dev/CAPn4x%2Br6n9nud%3Db%2BHNZe2_Se4x1eOH6vorrGNOXaYq06mPh2gA%40mail.gmail.com?utm_medium=email&utm_source=footer> >> . >> > -- You received this message because you are subscribed to the Google Groups "qtile-dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/qtile-dev/CADrRWNZTYw0De6Og%2Byj%3DYVuSCZxcTSR7uUE2fcG5E497hzj2%2BQ%40mail.gmail.com.
