qtile / qtile

:cookie: A full-featured, hackable tiling window manager written and configured in Python (X11 + Wayland)
http://qtile.org
MIT License
4.79k stars 698 forks source link

Thunderbird not launching in correct group #3500

Closed JoaoDiogoDuarte closed 2 years ago

JoaoDiogoDuarte commented 2 years ago

The issue:

I would like Thunderbird to open in group 9, but unfortunately, it seems to always open in group 8, no matter how I change my config. This occurs when thunderbird is launched at startup or when I open it during my workday (e.g. via a command or rofi). Below is the relevant section of the config:

groups = [
    Group(
        "1",
        label="爵",
        matches=[
            Match(wm_class="Firefox"),
            Match(wm_class="chromium-freeworld"),
        ],
    ),
    Group(
        "2",
        label="",
        matches=[
            Match(wm_class="vscodium"),
            Match(title="nvim"),
        ],
    ),
    Group(
        "3",
        label="",
        matches=[
            Match(wm_class="microsoft teams - preview"),
            Match(wm_class="web.whatsapp.com"),
        ],
    ),
    Group(
        "4",
        label="",
        matches=[
            Match(wm_class="xarchiver"),
            Match(wm_class="lightdm-gtk-greeter-settings"),
            Match(wm_class="stacer"),
            Match(wm_class="rygel-preferences"),
            Match(wm_class="libfm-pref-apps"),
            Match(wm_class="gnome-control-center"),
            Match(wm_class="malcontent-control"),
            Match(wm_class="blueman-adapters"),
            Match(wm_class="blueman-manager"),
            Match(wm_class="lxappearance"),
            Match(wm_class="gpartedbin"),
            Match(wm_class="grub-customizer"),
            Match(wm_class="gtklp"),
        ],
    ),
    Group(
        "5",
        label="",
        matches=[
            Match(wm_class="Joplin"),
            Match(wm_class="Leafpad"),
        ],
    ),
    Group(
        "6",
        label="",
        matches=[
            Match(wm_class="soffice"),
            Match(wm_class="atril"),
        ],
    ),
    Group(
        "7",
        label="",
        matches=[
            Match(wm_class="Spotify"),
            Match(wm_class="rythmbox"),
            Match(wm_class="ristretto"),
            Match(wm_class="mpv"),
            Match(title="GNU Image Manipulation Program"),
        ],
    ),
    Group(
        "8",
        label="",
        spawn=[
            "cisco-anyconnect",
            "protonmail-bridge --no-window",
        ],
        matches=[
            Match(wm_class="Cisco AnyConnect Secure Mobility Client"),
            Match(wm_class="Proton Mail Bridge"),
            Match(wm_class="protonvpn"),
            Match(wm_class="xasy"),
            Match(wm_class="deluge"),
            Match(wm_class="fontforge"),
            Match(title="Cryptomator"),
            Match(title="ecl"),
            Match(title="gap"),
            Match(title="Jmol"),
            Match(title="gp"),
            Match(title="Singular"),
            Match(title="Steam"),
        ],
    ),
    Group(
        "9",
        label="",
        spawn="thunderbird",
        matches=[
            Match(wm_class="thunderbird"),
        ],
    ),
]

This issue only happens with Thunderbird (and Spotify it seems, but I will try to fix it myself and if not, I will submit a new issue). I have confirmed with xprop that I am using the correct wm_class.

I am using version 0.21.1.dev9+g634a470a (straight from github but I had this issue in the stable 0.21.0). I cannot find anything of interest in the logs to include here.

Thanks!

Required:

elParaguayo commented 2 years ago

You could be running into this issue (https://github.com/qtile/qtile/issues/2405) where the class is not correct when the window spawns.

JoaoDiogoDuarte commented 2 years ago

Adapting one of the replies in the issue you linked, it worked!

@hook.subscribe.client_new
async def move_client(client):
    await asyncio.sleep(0.01)
    if client.name == "spotify":
        client.cmd_togroup(group_name="7")
    if client.name == "Home - Mozilla Thunderbird":
        client.cmd_togroup(group_name="9")

However, I am not sure if this addressed the root cause as if you log the client name before the 'await asyncio.sleep', you get spotify and if you log it after, you also get spotify. I was expecting that the client name before the sleep would be (e.g.) None.

elParaguayo commented 2 years ago

That's good news.

As for Spotify - your Match rule was looking at the class, rather than the name. So try logging that and seeing if the class is None.

kaistian commented 2 years ago
$ xprop | grep CLASS
WM_CLASS(STRING) = "Mail", "Thunderbird"

Have you tried Thunderbird with a capital T wm_class="Thunderbird"?