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::"; 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);