def test_unsupported_widget(manager_nospawn):
    """Widgets on unsupported backends should be removed silently from the bar."""

    class UnsupportedWidget(libqtile.widget.TextBox):
        if manager_nospawn.backend.name == "x11":
            supported_backends = {"wayland"}
        elif manager_nospawn.backend.name == "wayland":
            supported_backends = {"x11"}
        else:
            pytest.skip("Unknown backend")

    class UnsupportedConfig(BareConfig):
        screens = [libqtile.config.Screen(top=libqtile.bar.Bar([UnsupportedWidget()], 20))]

    manager_nospawn.start(UnsupportedConfig)

    assert len(manager_nospawn.c.bar["top"].info()["widgets"]) == 0
Widgets on unsupported backends should be removed silently from the bar.
test/test_bar.py