Let the launcher find an icon for the window
The icon was already embedded and had been all along: `app.slint` sets it and `build.rs` compiles it into the binary with `EmbedFiles`. That is not what a Wayland compositor looks at. It ignores a client-set icon entirely, matches the surface's `app_id` against installed `.desktop` files, and takes the icon from the one whose basename agrees. Nothing set an app id and no desktop entry existed, so GNOME had nothing to resolve and drew the placeholder. Both halves are needed and neither substitutes for the other: the embedded icon is what X11 and the window itself use, and the desktop entry is what the overview, the dash and alt-tab use. The app id, the `.desktop` basename and the installed icon's filename are one string in three places — `paris.tourolle.darkroom`, the same reverse-DNS name the Android manifest already uses, because it is one application. Change one without the others and the icon disappears again with nothing logged, so each file says so where the string appears. The PKGBUILD builds from the checkout rather than a release tarball, so `makepkg -si` installs what is being worked on. Install verified by inspection of the built package: binary, desktop entry, and the icon under hicolor/256x256 by the name the entry asks for. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -733,6 +733,30 @@ pub fn run(paths: Vec<PathBuf>) -> Result<()> {
|
||||
let entries = Rc::new(RefCell::new(collect(&paths)));
|
||||
log::info!("{} image(s) to browse", entries.borrow().len());
|
||||
|
||||
// TRACES: FR-PLAT-LIN-1
|
||||
// The name the compositor knows this window by, and the reason the
|
||||
// launcher shows a real icon rather than a grey square.
|
||||
//
|
||||
// `app.slint` sets `icon:`, and that is genuinely embedded (see
|
||||
// `build.rs`) — but a Wayland compositor ignores a client-set icon
|
||||
// entirely. It takes the icon from the `.desktop` file whose basename
|
||||
// matches the surface's `app_id`, and nothing else. So the embedded icon
|
||||
// is what X11 and the window itself use, and *this* is what GNOME's
|
||||
// overview, dash and alt-tab use. Both are needed and neither substitutes
|
||||
// for the other.
|
||||
//
|
||||
// The string must equal the installed `.desktop` file's basename exactly:
|
||||
// `packaging/paris.tourolle.darkroom.desktop`. It matches the Android
|
||||
// package id (`AndroidManifest.xml`) on purpose — one application, one
|
||||
// reverse-DNS name on both platforms.
|
||||
//
|
||||
// Before the window, necessarily: it is read when the surface is created.
|
||||
if let Err(e) = slint::set_xdg_app_id("paris.tourolle.darkroom") {
|
||||
// Not fatal. On X11 and on Android this does nothing useful, and a
|
||||
// missing app id costs an icon rather than a working application.
|
||||
log::debug!("could not set the xdg app id: {e}");
|
||||
}
|
||||
|
||||
// Before the window, and it has to be: this selects the Slint backend, and
|
||||
// creating a window selects one for us. See `shared_gpu`. The device is
|
||||
// shared by demosaic, the adjust pass and the compositor; without one the
|
||||
|
||||
Reference in New Issue
Block a user