webui-dev / nim-webui

Use any web browser as GUI, with Nim in the backend and HTML5 in the frontend.
https://webui.me
MIT License
130 stars 9 forks source link

Visual bugs within GTK/GNOME #33

Open krissh-wtf opened 3 months ago

krissh-wtf commented 3 months ago

I recently switched to Gnome on Wayland and have noticed that titles and icons don't actually work and the bookmarks toolbar is enabled by default. screenshot Also seems that windows fade weirdly but that might be a firefox issue. screenshot

Here is the code i used:

proc window*() =
    let
        window = newWindow()
        icon = "data:image/png;base64,..."
        iconType = "image/png"

    window.rootFolder=currentSourcePath().parentDir().parentDir() / "ui"
    window.setIcon(icon, iconType)
    window.show(renderIndex())

    wait()
krissh-wtf commented 3 months ago

i would also like to note that i tried compiling the text editor example to see if it was a problem on my end but i realized it wasn't even written to use the icon

krissh-wtf commented 3 months ago

and if you're wondering renderIndex() is karax:


proc renderIndex*(): string =
  let vnode = buildHtml(tdiv):
    html(lang = "en"):
      head:
        meta(charset = "UTF-8")
        meta(content = "width=device-width, initial-scale=1.0", name="viewport")
        meta(content = "default-src 'self'", http-equiv = "Content-Security-Policy")
        title:
          text readSettings("appearance", "title")
        script(src="webui.js")
        link(rel="stylesheet", href="ui/themes/normalize.min.css")
        link(rel="stylesheet", href="ui/themes/default.css")
      body:
        header:
          hgroup:
            h1:
              bold:
                text readSettings("appearance", "title")
            p:
              text readSettings("appearance", "welcome_text")
        footer:
          p:
            text "made with love in france"

  result = $vnode

but i have tried it with raw html but it doesn't change anything

krissh-wtf commented 3 months ago

I just noticed but the menubar seems to be over the window decoration? image

so this may all just be a firefox issue, currently using 125.0.3 but i have tried it on LTS edition which is on 115 but it's still the same issue

AlbertShown commented 3 months ago

This issue exist only in Firefox, if you change the browser it will look fine window.show(renderIndex(), Browsers.Chrome).

If you want to try to fix this issue in Firefox, you can tweak the UI by modifying this file in Linux: /tmp/.WebUI/WebUIFirefoxProfile/chrome/userChrome.css.

If you managed to make UI look better, please submit the userChrome.css CSS code so someone add it to webui code.