I have a personal project that is an elixir desktop application for PC Windows. It works pretty well, but now I want to give it an icon.
This is usually done in the following module:
defmodule WebInterface.Application do
# See https://hexdocs.pm/elixir/Application.html
# for more information on OTP Applications
@moduledoc false
use Application
alias Desktop
alias Manager
alias WebInterface.{Endpoint, Telemetry}
alias WebInterface.Live.MenuBar
@impl true
def start(_type, _args) do
children = [
Telemetry,
{Phoenix.PubSub, name: WebInterface.PubSub},
Endpoint,
Manager,
{Desktop.Window,
[
app: :web_interface,
id: WebInterface,
title: "Market Manager",
size: {900, 960},
menubar: MenuBar,
icon: "static/images/resized_logo_4.png", # THIS IS WHERE THE ICON IS SET
url: &WebInterface.Endpoint.url/0
]}
]
opts = [strategy: :one_for_one, name: WebInterface.Supervisor]
Supervisor.start_link(children, opts)
end
@impl true
def config_change(changed, _new, removed) do
WebInterface.Endpoint.config_change(changed, removed)
:ok
end
end
The issue here is that I have to use the same image for both the Windows taskbar and the top icon of the app:
The issue here is that while the logo on the bottom Windows bar (marked yellow) is nice, the one in the top is distorted and pretty horrible.
The fix to this would be to have an icon for the bottom and one for the top. However after checking the demo app I didn't find a way of doing this.
Is this possible to achieve? If so, how?
After asking in several places I was able to find some answers. In fact this post can be summarized in 2 questions:
After checking with the official wxWidgets forums and getting help from the lovely folks there, I was pointed out that my icons did not confirm to the MSW standards for icons. In my case, these needed to be 32x32 or 16x16.
Research:
This one is a bit more tricky. There is a chance that using wxWidgets directly this could have been possible via the use of overlay icons. However, the library binding I use, elixir-desktop, does not support this, which means the icons need to be the same.
This is probably for the best, because as mentioned by the wxWidgets community, even such a use of overlay icons would not be standard amongst MSW applications, which is my case.
Research: