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:

Popular Backend topics Top

dimitarvp
As a part of my new job I’ll have to learn to manage a local k8s cluster. The tools used are microk8s, tilt and helm. I’ll appreciate an...
New
Kurisu
Following on an old discussion I started on Elixir Forum here, I finally made my mind to learn Ruby on Rails in addition to Elixir/Phoen...
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
Are there any databases that require no setup (can be shipped in a small zip together with the project)?
New
joshi
Hey everybody! I’m working on the project that includes import of Oracle data to PostgreSQL. That data comes as Oracle export (expdp) fi...
New
Fl4m3Ph03n1x
Background PS: the following situation describes an hypothetical scenario, where I own a company that sells things to customers. I have ...
New
Manish_bose
Can anyone help me how to convert a long data to wide data in SQL without using hard coding? Regards Manish
New
harwind
In C, how they are different? char str[] = "xyz"; // statement //and char str[4] = "xyz"; // statement The first, i...
/c
New
harwind
I have a large SQL database with millions of records, and I’ve identified duplicate entries. What’s the most efficient way to find and re...
New
Patricia-Mendes13
Hi guys!! I´m studying and got a Full stack course but the course lacked a lot of support and and info to learn as it´s a course after wo...
New

Other popular topics Top

Devtalk
Hello Devtalk World! Please let us know a little about who you are and where you’re from :nerd_face:
New
axelson
I’ve been really enjoying obsidian.md: It is very snappy (even though it is based on Electron). I love that it is all local by defaul...
New
dasdom
No chair. I have a standing desk. This post was split into a dedicated thread from our thread about chairs :slight_smile:
New
PragmaticBookshelf
Rust is an exciting new programming language combining the power of C with memory safety, fearless concurrency, and productivity boosters...
New
AstonJ
Do the test and post your score :nerd_face: :keyboard: If possible, please add info such as the keyboard you’re using, the layout (Qw...
New
foxtrottwist
A few weeks ago I started using Warp a terminal written in rust. Though in it’s current state of development there are a few caveats (tab...
New
AstonJ
We’ve talked about his book briefly here but it is quickly becoming obsolete - so he’s decided to create a series of 7 podcasts, the firs...
New
New
PragmaticBookshelf
Author Spotlight: Bruce Tate @redrapids Programming languages always emerge out of need, and if that’s not always true, they’re defin...
New
AstonJ
Curious what kind of results others are getting, I think actually prefer the 7B model to the 32B model, not only is it faster but the qua...
New