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

dominicletz

dominicletz

Creator of Elixir Desktop

Ah yes, that was a misunderstanding I thought you’re talk about the little status icon in the corner :innocent:

The second one (the little corner icon) can be changed independently – but the larger one yes seems always to be the same as the main-window one. (I expect that to be a wxWidgets limitation though, not a system limit)

Also Liked

dominicletz

dominicletz

Creator of Elixir Desktop

There are two ways to do this:

  1. You call Desktop.Menu.set_icon after application startup to change the taskbar icon like the sample application does: desktop-example-app/menu.ex at 1661b9bf28c09bbbd2ce87ffe5e4dd1dd8e21ccf · elixir-desktop/desktop-example-app · GitHub

  2. You use the new :taskbar_icon option in v1.4.2 :

{Desktop.Window,
       [
         app: :web_interface,
         id: WebInterface,
         title: "Market Manager",
         size: {900, 960},
         menubar: MenuBar,
         icon: "static/images/resized_logo_4.png",
         taskbar_icon: "static/images/taskbar_logo.png",
         url: &WebInterface.Endpoint.url/0

Hope this helps!

Fl4m3Ph03n1x

Fl4m3Ph03n1x

After asking in the wxWidgets forum about this same issue I got the following reply:

[…](MSW only) If the icon in the taskbar is from the active application window, I don’t think the two can be different (aside from using an overlay icon etc with wxTaskBarButton). […]

source: https://forums.wxwidgets.org/viewtopic.php?f=27&t=49813

I am lead to believe that perhaps this is not possible using desktop-elixir. Maybe I am incorrect, but I am not sure elixir-desktop uses or supports overlays with wxTaskBarButtons for this purpose.

Where Next?

Popular in Questions Top

JDanielMartinez
Hi! May someone helps me, please! I have two apps into an umbrella project: the first one is Database, which manages queries, and the se...
New
LegitStack
I’m hoping you guys can give me some general advice and perhaps code examples if you’re feeling up to it. I’m very interested in Elixir,...
New
hariharasudhan94
I would like to know what is the best IDE for elixir development?
New
mcarvalho
What is the difference between System.get_env and Application.get_env? For example, what are best practices to use one versus another.
New
minhajuddin
I have seen a lot of code which picks the first element from a list using Enum.at(0) instead of List.first. Is there a reason why people ...
New
fayddelight
I tried installing elixir 1.11.2 erlang 23.3.4 via asdf in my zsh shell. Enabled the versions locally and globally. When I list them ...
New
shahryarjb
Hello, I have map which I want to convert it to string like this: the map: %{last_name: "tavakkoli", name: "shahryar"} the string I ne...
New
fireproofsocks
Forgive me if this is obvious, but how does one delete a database record WITHOUT selecting it first? https://hexdocs.pm/ecto/Ecto.Repo.h...
New
chrisalley
ExUnit now has describe blocks which is a welcome addition coming from RSpec. In the docs, it states that nested hierarchies of describe ...
New
joeerl
Hello again - after a longish gap I’ve decided I really must dig into Elixir and see what’s been happening here - so I have a few questio...
New

Other popular topics Top

chrismccord
Phoenix 1.4.0 released Phoenix 1.4 is out! This release ships with exciting new features, most notably with HTTP2 support, improved deve...
688 30048 115
New
shahryarjb
Hello, I get Persian date from my client and convert it to normal calendar like this: def jalali_string_to_miladi_english_number(persi...
New
lessless
I believe there are people here who are dealing with CSV files import on the daily basis, and since Excel is a really popular tool there ...
New
albydarned
Hello all! I am typing this post from my new MacBook Pro with the M1 chip. I’m loving it so far, and will probably use it as my daily dr...
New
jerry
Good day to you all. I have been struggling to get a query involving like and ilike to work. Can anyone assist me on this, please? pro...
New
sergio_101
I am VERY much an elixir newbie. I have taken one elixir course and one phoenix course on Udemy. During that course, I saw the instructor...
New
AstonJ
You’re a programmer, so you don’t need spoon feeding with the conventional drivel about “this is an integer.” No. You need to know what’s...
New
_russellb
I want to try my hand at web scraping. What tools/libraries do I need to use. I’m hoping to turn this into something professional so don’...
New
malloryerik
Hi, this is for people who, like me, have had some friction using .html.heex templates in VSCode. The solution seems to be, in a hyphena...
New
script
If I have a string “1000 cfu/ml” . I want to remove the characters and / and space . So the string is like this "1000" What is the ...
New

We're in Beta

About us Mission Statement