From 0b938da55eb7d1d08845017470d531974d552354 Mon Sep 17 00:00:00 2001 From: "Enzo Persillet (Tutez)" Date: Fri, 8 May 2026 22:53:38 +0200 Subject: [PATCH 1/2] Generate Linux icon assets from project icons Create bin/linux/bin/icon.png from project icons during Linux builds, falling back to the default Lime icon when no project icon is defined. --- tools/platforms/LinuxPlatform.hx | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/tools/platforms/LinuxPlatform.hx b/tools/platforms/LinuxPlatform.hx index 1a622b4aee..8f30c16c3a 100644 --- a/tools/platforms/LinuxPlatform.hx +++ b/tools/platforms/LinuxPlatform.hx @@ -13,6 +13,8 @@ import lime.tools.AssetType; import lime.tools.CPPHelper; import lime.tools.DeploymentHelper; import lime.tools.HXProject; +import lime.tools.Icon; +import lime.tools.IconHelper; import lime.tools.JavaHelper; import lime.tools.NekoHelper; import lime.tools.NodeJSHelper; @@ -627,7 +629,15 @@ class LinuxPlatform extends PlatformTarget ProjectHelper.recursiveSmartCopyTemplate(project, "cpp/static", targetDirectory + "/obj", context); } - // context.HAS_ICON = IconHelper.createIcon (project.icons, 256, 256, Path.combine (applicationDirectory, "icon.png")); + var icons = project.icons; + + if (icons.length == 0) + { + icons = [new Icon(System.findTemplate(project.templatePaths, "default/icon.svg"))]; + } + + context.HAS_ICON = IconHelper.createIcon(icons, 256, 256, Path.combine(applicationDirectory, "icon.png")); + for (asset in project.assets) { var path = Path.combine(applicationDirectory, asset.targetPath); From 863a408b82c7e64abc64f4cee853c985fbf28cb8 Mon Sep 17 00:00:00 2001 From: "Enzo Persillet (Tutez)" Date: Fri, 8 May 2026 22:54:01 +0200 Subject: [PATCH 2/2] Apply generated Linux window icon at startup Load icon.png from the application directory in the generated Linux ApplicationMain and pass it to the window icon API. --- templates/haxe/ApplicationMain.hx | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/templates/haxe/ApplicationMain.hx b/templates/haxe/ApplicationMain.hx index 422fbcb030..fc7b9c616b 100644 --- a/templates/haxe/ApplicationMain.hx +++ b/templates/haxe/ApplicationMain.hx @@ -89,6 +89,17 @@ import ::APP_MAIN::; } app.createWindow(attributes); + #if (linux && sys) + var iconPath = lime.system.System.applicationDirectory + "/icon.png"; + if (sys.FileSystem.exists(iconPath)) + { + var icon = lime.graphics.Image.fromFile(iconPath); + if (icon != null && app.window != null) + { + app.window.setIcon(icon); + } + } + #end ::end:: #elseif air app.window.title = "::meta.title::";