TimUntersberger / nog

A tiling window manager for Windows
MIT License
697 stars 20 forks source link

current_window() shows question mark for Microsoft Edge #266

Closed garymm closed 3 years ago

garymm commented 3 years ago

Instead of "Microsoft Edge", it's rendered as "Microsoft? Edge": image

The built-in Alt-Tab view in Windows shows the same title except without the question mark.

My bar config:

nog.bar.configure(#{
    font_size: 16,
    components: #{
        center: [
            components.current_window()
        ],
...
ramirezmike commented 3 years ago

Are you specifying a font in your config? I use nog on two computers and don't really mess with fonts much but I have noticed that one of my computers supports emojis in my config and the other doesn't, but they're both configured for the same font and I use the same config on both so one of them shows emojis I have configured and the other just shows question marks. I guessing there's some character after the word "Microsoft" that the font is displaying as ?. I'm seeing the same thing as you when I open edge but.. yeah, in edge it doesn't show anything, just a space.

So... we might be able to do something where we can set it to show a space instead of a question mark... but I also suspect there might be an alternative solution involving installing fonts which seems like a small nightmare.

garymm commented 3 years ago

No I'm not specifying a font. I can try different fonts, but was hoping the default would be safe. What determines what font is used if none is specified?

ramirezmike commented 3 years ago

The default font is Consolas (you can see here)

We use GetWindowTextA to get the value of the window's title. I can see that this is the output of that call when Edge is focused.

77 105 99 114 111 115 111 102 116 32 69 100 103 101 32 45 32 80 114 111 102 105 108 101 32 49 32 45 32 77 105 99 114 111 115 111 102 116 63 32 69 100 103 101

which... is

Microsoft Edge - Profile 1 - Microsoft? Edge

This is the Microsoft? part

77 105 99 114 111 115 111 102 116 63 M i c r o s o f t ?

63 is literally question mark "?"

So... I don't know what to say, for some reason it's literally outputting the ? character and there must be something in the Edge browser that interprets it differently. Currently, I'm leaning toward closing this as won't fix because I don't think there's much we can do outside of adding code to handle this specific thing which seems kinda hacky, especially since we wouldn't be able to tell what's an actual question mark that should display as a question mark.

Let me know what you think though @garymm

garymm commented 3 years ago

Thanks for looking at this. I reported the bug through the "send feedback" menu in Microsoft edge. Hopefully someone will take a look. "Won't fix" seems reasonable to me.

garymm commented 3 years ago

The Edge team replied to me that they inserted a zero-width space character into the window title to hack around some other app that had special behavior for the old non-Chromium Edge. I guess the A in GetWindowTextA stands for "ANSI", and so I think it may be expected that this non-ANSI character gets converted to a question mark before being returned. Can you switch to GetWindowTextW instead?

TimUntersberger commented 3 years ago

This is hopefully fixed in the latest release.

TimUntersberger commented 3 years ago

Closing as this seems to be fixed.