def test_widgetbox_with_systray_reconfigure_screens_box_closed(
    manager_nospawn, minimal_conf_noscreen, backend_name
):
    """Check that Systray does not crash when inside a closed widgetbox."""
    if backend_name == "wayland":
        pytest.skip("Skipping test on Wayland.")

    config = minimal_conf_noscreen
    config.screens = [
        libqtile.config.Screen(top=libqtile.bar.Bar([WidgetBox(widgets=[Systray()])], 10))
    ]

    manager_nospawn.start(config)

    topbar = manager_nospawn.c.bar["top"]
    assert len(topbar.info()["widgets"]) == 1

    manager_nospawn.c.reconfigure_screens()

    assert len(topbar.info()["widgets"]) == 1

    # Check that we've still got a Systray widget in the box.
    _, name = manager_nospawn.c.widget["widgetbox"].eval("self.widgets[0].name")
    assert name == "systray"
Check that Systray does not crash when inside a closed widgetbox.
test/widgets/test_widgetbox.py