<html>
<head>
<base href="https://bugzilla.gnome.org/" />
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW - set_icon_from_file not working"
href="https://bugzilla.gnome.org/show_bug.cgi?id=767966">767966</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>set_icon_from_file not working
</td>
</tr>
<tr>
<th>Classification</th>
<td>Platform
</td>
</tr>
<tr>
<th>Product</th>
<td>gtk+
</td>
</tr>
<tr>
<th>Version</th>
<td>3.20.x
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>Normal
</td>
</tr>
<tr>
<th>Component</th>
<td>Backend: Wayland
</td>
</tr>
<tr>
<th>Assignee</th>
<td>gtk-bugs@gtk.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>optimisme@gmail.com
</td>
</tr>
<tr>
<th>QA Contact</th>
<td>gtk-bugs@gtk.org
</td>
</tr>
<tr>
<th>CC</th>
<td>rob@robster.org.uk, wayland-bugs@lists.freedesktop.org
</td>
</tr>
<tr>
<th>GNOME version</th>
<td>---
</td>
</tr></table>
<p>
<div>
<pre>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:
<a href="https://github.com/optimisme/gjs-examples/blob/master/egIcon.js">https://github.com/optimisme/gjs-examples/blob/master/egIcon.js</a>
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);
};</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>