question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Application name is not shown in the gnome top bar

See original GitHub issue

Describe the bug See this image how just the logo (and no name of any kind) is shown when an avalonia app is running on gnome: Kuvakaappaus - 2022-02-23 16-58-51

(top left in the image, to the right of the avalonia icon there should be some kind of name) I was unable find any info about how to fix that. I tried grabbing:

    <NativeMenu.Menu>
        <NativeMenu />
    </NativeMenu.Menu>

from: https://github.com/VitalElement/Xune/blob/main/Xune.Desktop/App.axaml but that didn’t help at all

To Reproduce Steps to reproduce the behavior:

  1. Run commands:
dotnet new -i Avalonia.Templates
mkdir MyApp
cd MyApp/
dotnet new avalonia.mvvm
dotnet run
  1. Look at the top left of the screen and notice how the program name is missing

Expected behavior I expected at least something like MyApp (which seems to be the executable name generated) to be there, but instead it looks like avalonia tries to use some smarter API to report a different name to gnome but that apparently fails entirely.

If this is a documentation issue rather than a bug, this is still pretty serious (and a pretty big oversight in the templates), and doesn’t look very professional at all. The other times I’ve seen this happen basically have been me messing with a GUI framework and making it accidentally broken.

Screenshots See the first section of this issue

Desktop (please complete the following information):

  • OS: Linux (Fedora 35)
  • Should be the latest templates version (I just ran the avalonia template install command again). Looks like it puts 0.10.12 as the avalonia version in the created MyApp.csproj file

Additional context Problem visible even with the template application.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:8 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
hhyyrylainencommented, Jul 26, 2022

I’ll close this as https://github.com/AvaloniaUI/Avalonia/pull/8597 is now merged.

1reaction
hhyyrylainencommented, Jul 25, 2022

I investigated this and it seems that Avalonia doesn’t call XSetClassHint which is what sets that text. Experimentally I put some code into X11Window.SetIcon to just put a test name on the Window, and a bit surprisingly it actually works:

Kuvakaappaus - 2022-07-25 16-14-58

Here’s the relevant code:

                var classHint = XAllocClassHint();

                var classHintData = (XClassHint)Marshal.PtrToStructure(classHint, typeof(XClassHint));

                var classTextData = Marshal.StringToHGlobalAnsi("test name");

                classHintData.ResClass = classTextData;
                classHintData.ResName = classTextData;

                Marshal.StructureToPtr(classHintData, classHint, true);

                XSetClassHint(_x11.Display, _handle, classHint);

                XFree(classHint);

                Marshal.FreeHGlobal(classTextData);

Note I had to add those class hint function and struct definitions as they didn’t seem to exist yet.

I’ll try to find the right place and attempt to clean up that code a bit, and then I think I could submit a PR.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Application icon not appearing next to application name in ...
Open the gnome-shell.css file in /usr/share/themes/Arc-Dark/gnome-shell/ , and edit the .app-menu-icon class. Change the width and height ...
Read more >
Gnome Top Bar - missing application name? - Solus Forum
Help - I just installed Gnome and noticed the application name isn't showing up on the top bar. Is there a way to...
Read more >
Won't we have the name of the current focused application ...
I just do not like application names on bars. In my case, find it distracting and visually unappealing. Linux = choice = freedom...
Read more >
Set application display name and icon without an installed ...
The app I'm currently working on doesn't have a desktop entry because it's launched from an extension's panel widget. I could add a...
Read more >
Loss of application icons in GNOME Shell top bar
Open the Gnome Tweak tool (install it if you do not yet have it). Under "Top bar", turn "Application menu" on. This will...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found