GNOME Bugzilla – Bug 767966
set_icon_from_file not working
Last modified: 2018-05-02 17:14:11 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); };
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.
Thanks.
agreed
For now, I've documented all window-icon related api as 'may not work on some platforms'.
Is anything likely to be done here?
beyond documenting the limitation ? no we may want to relegate this to x11-specific api in the master
*** Bug 791569 has been marked as a duplicate of this bug. ***
-- 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.