Git Product home page Git Product logo

Comments (12)

wwderw avatar wwderw commented on August 25, 2024 1

I did take a look at a program that I use to flash my keyboard's firmware with as that is build with Wails and on their Linux version, they don't have an icon set. Looking through the documentation, apparently Linux isn't supported as far as easy packaging and since they "bundled" the conversation of the program's icon with packaging, I would say that it includes setting the icon as well for Linux.

from nimview.

marcomq avatar marcomq commented on August 25, 2024 1

I changed the way I import webview. This should hopefully avoid the "bad import".
Also, I changed the way webview is closed, so hopefully, the application stops when stopping webview now.

Currently, the only problem left is that the icon needs to be in some file when nimview starts and it is not compiled into the binary. I guess using nimassets is one do-able way to handle this.

Will close this for now and will create a new tag soon.
Let me know if you still have some issues and thx for the hints and for trying out :)

from nimview.

marcomq avatar marcomq commented on August 25, 2024

I haven't tried, but I think this might already work when unsing a .rc and an .ico file. Nimview is using the same webview code as wails and there already was a fix to wails for this:
wailsapp/wails#424

from nimview.

wwderw avatar wwderw commented on August 25, 2024

Aaahhh ok. I'll go digging around and see what I can come up with.

Thanks for the help.

from nimview.

marcomq avatar marcomq commented on August 25, 2024

Will probably also have a deeper look at this when I have time.
Keep me up to date if you somehow find a way to set the icon. Maybe it just works different for "Wails". Maybe this still is simple.

Thx for creating the issue. I completely forgot about the icon :)

from nimview.

wwderw avatar wwderw commented on August 25, 2024

Nothing so far, but it could be related to the fact that I'm on Linux, even that issue only referenced windows and mac, so even if I do have it right, it may still not be showing up due to being on Linux and having to run .png versus .ico and I'm still getting the standard x11 window icon for webkit.

from nimview.

marcomq avatar marcomq commented on August 25, 2024

Thx for having a look.
It seems that this might be something that gtk could do.
Nimview is using webview and webview is using gtk on linux. Using internal gtk functions could do the trick on linux.
Accoring to this gh issue webview/webview#28
There is a gtk api to change the icon.
https://developer.gnome.org/gtk3/stable/GtkWindow.html#gtk-window-set-icon
So - it might be necessary to call plain C functions and/or change webview.h to implement this.
Not sure if this function still exists, if this actually works or if this just might be complicate to implement.
Just wanted to let you know.

from nimview.

marcomq avatar marcomq commented on August 25, 2024

I just added an option to add an icon. You can call a function before calling run:

startDesktop("dist/index.html", run=false)
setIcon(currentSourcePath.parentDir() / "icon.ico")
run()

I only tested it on windows, but it may also work on linux. There is a sample icon in "tests/icon.ico"

Not sure if this is the final version. It would probably be better to have the icon included in the binary. But this is at least some good start.

Edit:
Oh - and this isn't included yet in the latest tag. It is only available in the main branch.

from nimview.

wwderw avatar wwderw commented on August 25, 2024

Oh cool, I'll give this a shot when I'm back at that computer and see how that work for Linux.

Thanks!

from nimview.

wwderw avatar wwderw commented on August 25, 2024

It works if the html file isn't declared anywhere outside of the location that the program looks for to bundle it in the binary on it's own. When I try to point it to the temp location that's when the icon doesn't show up. Since I use nimassets to bundle everything, I would be declaring outside of the normal location.

It also doesn't appear to close out the connection when closing out the program. I notice that my CLI is still going after exiting the gui portion of the program.

from nimview.

wwderw avatar wwderw commented on August 25, 2024

It appears that if I were to install your version of webview, further in nimview's source, and import webview, I am able to do everything as expected with using nimassets and having the icon show up. At least on the Linux side. I have not tried this on my Windows machines yet.

Just thought I would mention that, hope it helps.

from nimview.

marcomq avatar marcomq commented on August 25, 2024

@wwderw
Thx. This helps a lot. I need to find out how my own library can prefer its webview folder instead of using an installed webview. No idea yet how to do this in Nim.

from nimview.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.