slint-ui / slint

Slint is a declarative GUI toolkit to build native user interfaces for Rust, C++, or JavaScript apps.
https://slint.dev
Other
17.64k stars 607 forks source link

[BUG] Window icon doesn't appear while using Wayland session #6771

Closed D4yvid closed 1 week ago

D4yvid commented 1 week ago

When you create a new window and set it's icon using the icon property, the icon doesn't appear on Wayland sessions, it only shows the Wayland's Logo instead. On X11 session it shows the icon, only on Wayland that it doesn't show.

Slint code:

export component AppMainWindow inherits Window {

    icon: @image-url("assets/logo-64x64.png");

    in property <[DeviceInformation]> enumerated_devices;

    VerticalBox {
       for device in enumerated_devices: Text {
            text: "Device \{device.rawPath}: \{device.vendor} \{device.model}";
        }
    }

}

C++ Code:

void before_exit(void)
{
    device_deinit();
}

int main(int argc, char **argv)
{
    atexit(before_exit);

    device_init();

    std::vector<DeviceInformation> devices;

    for (const auto &device : device_enumerate_all()) {
        devices.push_back(DeviceInformation {
            .name = device.name.c_str(),
            .removable = device.removable,
            .vendor = device.vendor.value_or("").c_str(),
            .model = device.model.value_or("").c_str(),
            .rawPath = device.rawPath.value_or("").c_str(),
        });
    }

    auto window = AppMainWindow::create();

    window->set_enumerated_devices(
        std::make_shared<slint::VectorModel<DeviceInformation>>(devices));

    window->run();

    return 0;
}

In X11: image

In Wayland: image

ogoffart commented 1 week ago

Wayland doesn't support window icon. It can have application icon only. (specified in a .desktop file.) Although for that to work, one need to be able to set the application id, which is currently not supported with the public API. (Tracked in https://github.com/slint-ui/slint/issues/1332 )

I'm going to close this issue as duplicate of https://github.com/slint-ui/slint/issues/1332 But thanks anyway for reporting an issue.