Fl4m3Ph03n1x

Fl4m3Ph03n1x

Is there a way to have 2 icons when using elixir-desktop?

Background

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

Problem

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.

Question

Is this possible to achieve? If so, how?

Marked As Solved

Fl4m3Ph03n1x

Fl4m3Ph03n1x

Solution

After asking in several places I was able to find some answers. In fact this post can be summarized in 2 questions:

  1. Why are the icons so distorted?
  2. Can I have an icon for the app different from the icon on the bottom bar?

Why are the icons so distorted?

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:

Can I have an icon for the app different from the icon on the bottom bar?

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:

Where Next?

Popular Backend topics Top

Kurisu
Hello and happy new year! I would like to buy a Ruby On Rails ebook for learning purpose. What would be the ROR equivalent of “Programm...
New
Jsdr3398
I’m trying to create a router where everything is in a collection of routes (similar to how I do my routes in expressjs). But it doesn’t ...
New
Jsdr3398
I’ve been working on and rewriting my messaging platform several times for the past two years. With Discords new rebranding, it has reall...
New
Fl4m3Ph03n1x
Background I am trying to up my Functional Programming (FP) skills and one of the things that newcomers first learn in FP is the Option T...
New
MarkIden
Hi, Recommend pls your favorite learning resources in Go, with best books, podcasts etc.
/go
New
GermaVinsmoke
Does anyone know beginner friendly Elixir/Phoenix Open source projects? For learning purpose :slightly_smiling_face:
New
Fl4m3Ph03n1x
Background PS: the following situation describes an hypothetical scenario, where I own a company that sells things to customers. I have ...
New
Fl4m3Ph03n1x
Background I am a fan of dialyzer and friends (looking at Gradient) and I try to have sepcs in my code as much as I can. To this end, I a...
New
harwind
I’m presently working on a backend development project to build a RESTful API using Python and Flask. The Scaler backend developer site h...
New
yamuna
Hi everyone, I’m trying to run deepseek-coder:6.7b-instruct-q4_K_M in Docker using Ollama to create an LLM that will be used by CrewAI a...
New

Other popular topics Top

malloryerik
Any thoughts on Svelte? Svelte is a radical new approach to building user interfaces. Whereas traditional frameworks like React and Vue...
New
wolf4earth
@AstonJ prompted me to open this topic after I mentioned in the lockdown thread how I started to do a lot more for my fitness. https://f...
New
PragmaticBookshelf
Design and develop sophisticated 2D games that are as much fun to make as they are to play. From particle effects and pathfinding to soci...
New
AstonJ
Continuing the discussion from Thinking about learning Crystal, let’s discuss - I was wondering which languages don’t GC - maybe we can c...
New
New
AstonJ
Was just curious to see if any were around, found this one: I got 51/100: Not sure if it was meant to buy I am sure at times the b...
New
Help
I am trying to crate a game for the Nintendo switch, I wanted to use Java as I am comfortable with that programming language. Can you use...
New
First poster: bot
Large Language Models like ChatGPT say The Darnedest Things. The Errors They MakeWhy We Need to Document Them, and What We Have Decided ...
New
New
New