Custom application menus
Basics
You can add new entries into main menu and game menu. Custom menu entries are currently only supported in Desktop mode.
Basics
To add new custom menu entries, implement appropriate menu script/plugin functions. Functions should return list of items that will be addded to a menu. Playnite passes GetGameMenuItemsArgs and GetMainMenuItemsArgs objects when the menu function is called.
You can use those argument objects to decide what elements to return. For example, in case of game menu, GetGameMenuItemsArgs
contains Games
field listing all currently selected games that are being used as a source for the game menu.
Note
Get*MenuItems
menu methods are executed each time a menu is opened. For that reason, make sure you are not executing long running code in those methods. It would otherwise result in a noticeable delay when opening the menu.
// To add new game menu items override GetGameMenuItems
public override List<GameMenuItem> GetGameMenuItems(GetGameMenuItemsArgs args)
{
return new List<GameMenuItem>
{
new GameMenuItem
{
Description = "Name of game menu item",
Action = (args) =>
{
// use args.Games to get list of games attached to the menu source
Console.WriteLine("Invoked from game menu item!");
}
}
};
}
// To add new main menu items override GetMainMenuItems
public override List<MainMenuItem> GetMainMenuItems(GetMainMenuItemsArgs args)
{
return new List<MainMenuItem>
{
new MainMenuItem
{
Description = "Name of main menu item",
Action = (args) => Console.WriteLine("Invoked from main menu item!")
}
};
}
Sub sections
You can add sub sections to menus by assigning MenuSection
property, sections can be nested. Sub sections are shared between extensions allowing multiple extensions to add items to a single sub section.
To add a menu item under single sub section, assign a string value: Section name
.
To add nested sections, separate definition with pipes: Section name|Sub section name
.
To add items under "Extensions" main menu section, add @
to the beginning of the section definition.
Icons
To add an icon to a menu item, assign a value to Icon
property of menu item. Currently supported values are:
- Full path to an image file.
- Theme relative file path to an image file.
- Key of an application resource.