git-for-windows / git

A fork of Git containing Windows-specific patches.
http://gitforwindows.org/
Other
8.37k stars 2.54k forks source link

Higher resolution Git icon for toast notifications #3984

Open ralish opened 2 years ago

ralish commented 2 years ago

Setup

$ git --version --build-options

git version 2.37.1.windows.1
cpu: x86_64
built from commit: 323a69709944b193bb5cee81ff09fe9a4a686df5
sizeof-long: 4
sizeof-size_t: 8
shell-path: /bin/sh
feature: fsmonitor--daemon
$ cmd.exe /c ver

Microsoft Windows [Version 10.0.19044.1889]
$ type "C:\Program Files\Git\etc\install-options.txt"

Editor Option: VIM
Custom Editor Path:
Default Branch Option: main
Path Option: Cmd
Plink Path: C:\Program Files\PuTTY\plink.exe
SSH Option: Plink
Tortoise Option: true
CURL Option: WinSSL
CRLF Option: CRLFAlways
Bash Terminal Option: ConHost
Git Pull Behavior Option: Rebase
Use Credential Manager: Enabled
Performance Tweaks FSCache: Enabled
Enable Symlinks: Enabled
Enable Pseudo Console Support: Enabled
Enable FSMonitor: Disabled

High-DPI display with resolution of 3840 x 2160.

Details

Primarily PowerShell under Windows Terminal.

N/A (triggered by release of new update resulting in a toast notification)

Git icon in appropriately high resolution.

Git icon which looks like a 16 x 16 bitmap ;)

Toast notification

Obviously only a cosmetic issue, but hopefully a relatively easy one to fix.

rimrul commented 2 years ago

Microsoft says that the dimensions of that image are 48x48 and we should provide versions for 100%, 125%, 150%, 200%, and 400% scaling.

The icon we use is our standard git-for-windows.ico, which contains versions of the logo in 16x16, 32x32 and 48x48, for 100%, 125%, 150%, 175%, 200%, 250%, 300%, 350%, 400%, 450% and 500%. So we should theoretically be good. But I think I've also experienced this in practice, so I'm not sure what's happening here.

ralish commented 2 years ago

@rimrul So my read of that documentation is that at 400% scaling the icon (app logo) should be 192 x 192. From a quick look at the code, this appears to be what's responsible for launching the toast notification: https://github.com/git-for-windows/build-extra/blob/f25e8f8602e1d37416bf774169592e6ed7cf390a/git-extra/git-update-git-for-windows#L297-L301

But that's just using the standard git-for-windows.ico icon which is 16 x 16 pixels (apparently I'm well calibrated to image dimensions!). There's nothing there I can see which is changing the icon by display scaling, and it's the only icon at that path.

rimrul commented 2 years ago

@rimrul So my read of that documentation is that at 400% scaling the icon (app logo) should be 192 x 192.

That math sounds correct.

From a quick look at the code, this appears to be what's responsible for launching the toast notification: https://github.com/git-for-windows/build-extra/blob/f25e8f8602e1d37416bf774169592e6ed7cf390a/git-extra/git-update-git-for-windows#L297-L301

That's correct.

But that's just using the standard git-for-windows.ico icon

That's also correct.

which is 16 x 16 pixels

That's incorrect. Or at least incomplete.

The ICO file format is an image file format for computer icons in Microsoft Windows. ICO files contain one or more small images at multiple sizes and color depths, such that they may be scaled appropriately.

(From https://en.wikipedia.org/wiki/ICO_(file_format))

.ico files can contain multiple resolutions of an image, and this one does. There's 16x16, 20x20, 24x24, 28x28, 32x32, 40x40, 48x48, 56x56, 60x60, 64x64, 72x72, 80x80, 84x84, 96x96, 112x112, 120x120, 128x128, 144x144, 160x160, 168x168, 192x192, 216x216, 240x240 and IIRC also 256x256 and 512x512 in there. Windows should automatically pick the appropriate one (or scale one down if it can't find the perfect one), but apparently sometimes fails to do that.

rimrul commented 2 years ago

sometimes fails to do that.

Scratch that, it seems to reliably fail every time on Windows 11.

dscho commented 1 week ago

Was there ever any conclusion? If not, let's just close this here ticket.