sylikc / jpegview

Fork of JPEGView by David Kleiner - fast and highly configurable viewer/editor for JPEG, BMP, PNG, WEBP, TGA, GIF and TIFF images with a minimal GUI. Basic on-the-fly image processing is provided - allowing adjusting typical parameters as sharpness, color balance, rotation, perspective, contrast and local under-/overexposure.
Other
2.06k stars 120 forks source link

Add *.jxl to Windows file associations (it's currently missing) #209

Open instinctualjealousy opened 1 year ago

instinctualjealousy commented 1 year ago

It's currently missing from the "Set defaults by app" list for JPEGView, which means I'd have to manually associate it. This is installed with the latest 64-bit MSI on latest Win10. image

sylikc commented 1 year ago

Hmm. JXL is configured in the setup already. Are the other file formats in the list?

instinctualjealousy commented 1 year ago

So I don't have to screenshot this massive Win10 UI, I'll type it out:

.arw
.bmp
.cr2
.crw
.dcr
.dng
.gif
.hdp
.jpeg
.jpg
.jxr
.kdc
.mrw
.nef
.nrw
.orf
.pef
.png
.raf
.rw2
.sr2
.tga
.tif
.tiff
.wdp
.webp
.x3f

From a user standpoint, the only thing I can think of is I installed JPEGView right as JXL support was shaping up, so JPEGView was upgrade-installed to a supporting build at some point. I'm using winget for this particular MSI. I checked About, I'm definitely on the latest release build.

JRHille commented 1 year ago

Hmm. JXL is configured in the setup already. Are the other file formats in the list?

Hi,

for me after the installation (msi installer) only the .jpg extension is associated... vmware_17qGEuClO1

So i manually included in the registry the other extensions that i use, like this:

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\sylikc\JPEGView\Capabilities\FileAssociations]
".png"="JPEGView.Document"
".webp"="JPEGView.Document"
".jpeg"="JPEGView.Document"
".jfif"="JPEGView.Document"
".gif"="JPEGView.Document"

and now they appear... vmware_ZXrWRa7keg

instinctualjealousy commented 1 year ago

Continuing on what @JRHille mentioned, I can confirm only .jpg is under Capabilities registration at the main SOFTWARE\sylikc\JPEGView location. Likely connected- I have two entries of JPEGView in my Associate by app list, one lists only .jpg as associable, and the other lists the formats I typed out in my prior post (minus the expected *.jxl).

image image

.jpg exists in both of these entries of JPEGView, and associating .jpg in one associates in both, so they're separate enough to be listed separately- but not separate enough that Windows thinks associating one is removing the association from the other.

sylikc commented 1 year ago

From a user standpoint, the only thing I can think of is I installed JPEGView right as JXL support was shaping up, so JPEGView was upgrade-installed to a supporting build at some point. I'm using winget for this particular MSI.

Thanks for that piece of critical info. Hmm, this may be some type of bug or something I might need to adjust in the setup on the upgrade.

The "upgrade" tests I did didn't include looking at file associations. The JXL and AVIF stuff didn't get file associations in the setup till very recently, so this is probably the most likely culprit.

I'll have to look into it... it's likely the file association registry entries are only populated on initial setup, and not on subsequent upgrades.

instinctualjealousy commented 1 year ago

From a user standpoint, the only thing I can think of is I installed JPEGView right as JXL support was shaping up, so JPEGView was upgrade-installed to a supporting build at some point. I'm using winget for this particular MSI.

Thanks for that piece of critical info. Hmm, this may be some type of bug or something I might need to adjust in the setup on the upgrade.

The "upgrade" tests I did didn't include looking at file associations. The JXL and AVIF stuff didn't get file associations in the setup till very recently, so this is probably the most likely culprit.

I'll have to look into it... it's likely the file association registry entries are only populated on initial setup, and not on subsequent upgrades.

image The Capabilities list has the filetypes in it now, as it should, after an uninstall and a reinstall. .jxl is still somehow missing, however! Going to do some manual registry cleanup to see if I can get this thing to register .jxl as it should.

sylikc commented 1 year ago

The Capabilities list has the filetypes in it now, as it should, after an uninstall and a reinstall. .jxl is still somehow missing, however! Going to do some manual registry cleanup to see if I can get this thing to register .jxl as it should.

Something's funky about the list... it doesn't have all the entries from the installer code. I'll have to do some testing to see why.

https://github.com/sylikc/jpegview/blob/d3dc3e39f5b21ab785241bcd3684d62ad662df0e/src/JPEGView.Setup/Product.wxs#L410-L439

The list according to the code SHOULD BE:

instinctualjealousy commented 1 year ago

I may not be fully correct in my own assumptions- anyway I uninstalled, cleaned up the registry- reset associations too (to clean out UserChoice, probably meaningless). With a clean install afterward, I only have a single JPEGView entry in my "Set defaults by app" page. Said page only has *.jpg registerable, just like @JRHille. Registry continues to look like it does for them as well.

I noticed something strange in my cleaning. The long list of entries that I captured for you (that isn't complete as you stated) existed in HKCU, under SOFTWARE\JPEGView\Capabilities, while the one your installer registered for me this time (a user note, I ran winget elevated, so perhaps I didn't run it elevated at one point in its install history?) threw it into HKLM\SOFTWARE\sylikc\JPEGView\Capabilities. I think I had two entries because Windows was referencing both HKCU and HKLM stores for RegisteredApplications. Another curious thing I noticed is *.jpg was registered both as a JPEGView.Document as well as a JPEGViewImage... or something to that effect, as it no longer exists in my registry and I can't confirm it.

sylikc commented 1 year ago

Thanks for your investigation. I'll try to get to it probably after this upcoming release. I took several weeks off and I have some other code I'm staring at in some half finished state 😵😒😡.

The installer and the registry keys could possibly be wrong. It definitely would be different when installing for All Users or installing for a single user. I'll have to run a few test cases on my test VMs to see how it shows up. TBH I didn't ever think about testing file associations... always thought it would just work 😂

JRHille commented 1 year ago

only .jpg is written to the registry vmware_kDjBppbM37

instinctualjealousy commented 1 year ago

only .jpg is written to the registry vmware_kDjBppbM37

Can confirm. I did a clean install (again) with MSI not elevated (single-user install) and I had the same behavior of only JPG being registered as I did in an elevated (All Users) install. There could still be something wrong with updating, but there's also definitely a problem with clean installs.

JRHille commented 1 year ago

I don't understand much about msi files, but I used this orca program to modify another installer once 😅, and from what you can see only the .jpg extension line is present in the installer I think Orca_fOkZm5j7Z8

sylikc commented 1 year ago

Is Orca this tool? I'll have to mess with it ...

https://learn.microsoft.com/en-us/windows/win32/msi/orca-exe

MSI is pretty complex... and I really had to take several weeks to understand and build the installer 2 years ago. I'd have to read more documentation and try to figure out the file associations.

Windows 7, 10, 11 ... all handle associations differently. I had read in dev docs that MS really locked down the abilities in past windows versions... and registries are different all a mess.

JRHille commented 1 year ago

Is Orca this tool? I'll have to mess with it ...

Yes.

I use it to modify the chrome and firefox installers and disable the creation of shortcuts on desktop and taskbar...

MSI is pretty complex... and I really had to take several weeks to understand and build the installer 2 years ago. I'd have to read more documentation and try to figure out the file associations.

I understand, it seems really complex, I myself don't understand almost anything, I just managed to get some tutorials to do the editing I wanted in the installers. 🤣