Summary: | [Feature] add appID&CLSID to existing Link | ||
---|---|---|---|
Product: | [Frameworks and Libraries] Snoretoast | Reporter: | Thomas <thomas> |
Component: | general | Assignee: | Hannah von Reth <vonreth> |
Status: | RESOLVED FIXED | ||
Severity: | wishlist | ||
Priority: | NOR | ||
Version: | unspecified | ||
Target Milestone: | --- | ||
Platform: | Microsoft Windows | ||
OS: | Microsoft Windows | ||
Latest Commit: | Version Fixed In: | ||
Attachments: | Non working PoC |
Hm any reason you can't remove and recreate the url? Additional Link-Properties (Icon, Parameters, ...) would get lost. The only scenario where a link with an app id is create I could imagine is during install. Every installer should know about Icons and parameters? Yes, but not every installer can handle PKEY_AppUserModel_ToastActivatorCLSID. I would have created the link first and if Windows-Version >= 8, I would have let Snoretoast add the appID and the CLSID to the existing link. Now, we will probably (but not surely) switch to an installer that let us set arbitrary attributes (including appID and PKEY_AppUserModel_ToastActivatorCLSID) to links, so this isn't urgent anymore. Still, this feature will probably be helpful to other projects. The recommended solution is to use snoretoast.exe in a post install step during installation to create the shortcut. But this requires to make the installer like this: if(Windows-Version >= 8) install shortcut using Snoretoast; else install shortcut yourself; add own properties to already existing shortcut; We are making the shortcut now using the wix-installer and setting the appid and clsid ourselfs. This makes us stay with one Snoretoast-Version or keep the Snoretoast CLSID up to date, but makes us independent of dependencies during install. Yes that's the way it was solved with nsis, and you would need to add an if clause to update the shortcut in a post install step too. I think -v should probably report the CLSID for scripting purposes, could be handy. Could you share the wix snippet so I can add it to the readme? :) Cheers, Hannah I really don't think that this is the way you want to do it since the SnoreToast-CLSID is hardcoded into the installer at the moment. We will write an entry in the Makefile that replaces the CLSID in the wixfile dynamically. But here it goes: <Directory Id="ProgramMenuDir" Name="Appname"> <Component Id="ProgramMenuDir" Guid="SOME-RANDOM-GUID"> <RemoveFolder Id="ProgramMenuDir" On="uninstall"/> <RegistryValue Root="HKLM" Key="Software\[Manufacturer]\[ProductName]\installed_shortcuts" Type="string" Value="" KeyPath="yes"/> <!-- Just done to have a keypath --> <Shortcut Id="startmenuNotifier" Directory="ProgramMenuDir" Name="Appname" Description="Appdec" Target="[#id_of_exe_component]" WorkingDirectory="INSTALLDIR" Icon="icon.ico" Advertise="no"> <ShortcutProperty Key="System.AppUserModel.ID" Value="com.example.appid" /> <ShortcutProperty Key="{9F4C2855-9F79-4B39-A8D0-E1D42DE1D5F3}, 26" Value="{SNORETOAST-GUID}"></ShortcutProperty><!-- System.AppUserModel.ToastActivatorCLSID written in hex to make it work on older Windows-Versions, too --> </Shortcut> <Shortcut Id="Uninstall" Name="Uninstall Portmaster" Target="[SystemFolder]msiexec.exe" Arguments="/x [ProductCode]" Description="Uninstalls Portmaster Application Firewall" /> <RegistryValue Root="HKCU" Key="SOFTWARE\Classes\CLSID\{SNORETOAST-GUID}\LocalServer32" Type="string" Value="C:\snoretoast.exe" /><!-- see snoretoast: linkhelper.cpp:86 --> </Component> </Directory> Thx, yes sadly the clsid needs to be hard coded as it gets compiled into the com interface... I added a NSIS headerfile that does exactly the same as my wix snippet, don't think you will want to use that either: https://github.com/safing/nsis-shortcut-properties I think for nsis https://github.com/KDE/snoretoast/#shortcut-creation-with-nsis is really the easiest way. A simple macro to create a shortcut, depending on the Windows version. No need to extract the clsid etc. But I think both scenarios should get documented in snoretoast. So thx for sharing. |
Created attachment 121474 [details] Non working PoC For some situations, it would be great to not create a new link, but add the appID and the CLSID to an existing Link while preserving the rest of the link. For example if the Symlink itself needs additional Attributes of if the appID changed, ... I already tried myself to get it working, will continue trying, but this is my first Windows-Project ...