Open darklinkpower opened 3 weeks ago
Hmm, is there any way to set an icon for the parent of a nested item? I want "restore save data..." to have an icon, but I can only seem to add it for the individual backups.
new GameMenuItem
{
Description = Etc.GetBackupDisplayLine(backup),
MenuSection = string.Format("{0} | {1}", translator.Ludusavi(), translator.RestoreSelectedGames_Label()),
Action = ...
}
If I add an extra GameMenuItem
just for "restore save data..." (with an icon but with no action), then I get one with the icon and one without 😅
I've opened a ticket for this: https://github.com/JosefNemec/Playnite/issues/3762
Yeah unfortunately currently it's not possible to set icons to items parents.
I think it would be a good UX improvement to display items alongside menu items. Playnite supports different values: https://api.playnite.link/docs/tutorials/extensions/menus.html?tabs=csharp#icons
Personally I like to use textblock using the available FontIcoFont font in Playnite because they can be styled by Playnite and themes. As a suggestion I'll share how I implemented it using application resources:
https://github.com/darklinkpower/PlayniteExtensionsCollection/blob/f2ca28640aef0d1a2dc8603bb345d732171cf818/source/Library/JastUsaLibrary/JastUsaLibrary.cs#L252-L257
This calls the method here that handles adding and returning the resource key after adding it: https://github.com/darklinkpower/PlayniteExtensionsCollection/blob/f2ca28640aef0d1a2dc8603bb345d732171cf818/source/Common/PlayniteUtilitiesCommon/PlayniteUtilities.cs#L370-L400
To see the available icons and their code, I use the program Character Map UWP: