fyne-io / fyne

Cross platform GUI toolkit in Go inspired by Material Design

Home Page:https://fyne.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

SetIcon don't work

inuyasha-660 opened this issue · comments

Checklist

  • I have searched the issue tracker for open issues that relate to the same problem, before opening a new one.
  • This issue only relates to a single bug. I will open new issues for any other problems.

Describe the bug

I use Arch on gnome46, when i use go run . to run the app, the icon that i set don't show , i can only see the default gnome app icon, i have tried to use hmclWindow_Main.SetIcon(icon) and FyneApp.toml to instead of it , but it still don't work .
I also use some example app with icon, but they still don't work .
Looking forward to your answers.

How to reproduce

  1. go run .

Screenshots

截图 2024-04-20 15-06-01

Example code

hmcl := app.New()
	icon, err := fyne.LoadResourceFromPath("./Resources/Icon.png")
	if err != nil {
		log.Println("==> Fail to load Icon.png")
	}
	hmcl.SetIcon(icon)
	hmclWindow_Main := hmcl.NewWindow("HMCL - 1.0.0")

Fyne version

fyne cli version: v2.4.5

Go compiler version

go version go1.22.2 linux/amd64

Operating system and version

ArchLinux 6.8.7-arch1-1

Additional Information

No response

The icon in OS launcher is created when you package/install the app, not when you run the binary.
Linux specifically reads these files from known locations on the storage, not from the application itself.

Run "fyne install" and the icon will appear.