After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 767966 - set_icon_from_file not working
set_icon_from_file not working
Status: RESOLVED OBSOLETE
Product: gtk+
Classification: Platform
Component: Backend: Wayland
3.20.x
Other Linux
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
: 791569 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2016-06-23 07:01 UTC by optimisme
Modified: 2018-05-02 17:14 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description optimisme 2016-06-23 07:01:59 UTC
window.set_icon_from_file(filePath) does not work on wayland, the icon is not set as the application icon. 

The same GJS application source runs fine when not using wayland.

Complete example:
https://github.com/optimisme/gjs-examples/blob/master/egIcon.js


The following source will return 'true' from 'set_icon_from_file' and won't report any error, but the icon won't be shown.


App.prototype.buildUI = function() {

    let result = false;

    this.window = new Gtk.ApplicationWindow({ application: this.application,
                                              title: this.title,
                                              default_height: 200,
                                              default_width: 200,
                                              window_position: Gtk.WindowPosition.CENTER });
    try {
        this.window.set_icon_from_file(path + '/assets/appIcon.png');
    } catch (err) {
        this.window.set_icon_name('application-x-executable');
    }

    this.label = new Gtk.Label({ label: "Hello icon" });
    this.window.add(this.label);
};
Comment 1 Jonas Ådahl 2016-06-23 07:08:20 UTC
In Wayland there is no such thing as a window icon. The closest thing you get is the application icon, which is derived from the .desktop file that comes with your application.

I'd suggest we mark the window-icon functions deprecated and make display server specific versions of them, so it is obvious that they are not something universally available.
Comment 2 optimisme 2016-06-23 07:22:25 UTC
Thanks.
Comment 3 Matthias Clasen 2016-06-24 21:00:30 UTC
agreed
Comment 4 Matthias Clasen 2016-08-24 18:45:17 UTC
For now, I've documented all window-icon related api as 'may not work on some platforms'.
Comment 5 Daniel Boles 2017-10-06 16:19:29 UTC
Is anything likely to be done here?
Comment 6 Matthias Clasen 2017-10-06 17:29:36 UTC
beyond documenting the limitation ? no
we may want to relegate this to x11-specific api in the master
Comment 7 Daniel Boles 2017-12-14 15:47:36 UTC
*** Bug 791569 has been marked as a duplicate of this bug. ***
Comment 8 GNOME Infrastructure Team 2018-05-02 17:14:11 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to GNOME's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/gtk/issues/637.