Documentation Index
Fetch the complete documentation index at: https://mintlify.com/geode-sdk/docs/llms.txt
Use this file to discover all available pages before exploring further.
Modifying Geode UI
Since Geode v3.4.0, mods are able to also modify the Geode UI itself in limited ways. This is so mods can do things like add extra buttons to their own mod’s popup, make their mod logo have particles, etc. This tutorial shows how to use these APIs to modify Geode’s own UIs.Listening for UI events
Geode currently exposes three UI events through the<Geode/ui/GeodeUI.hpp> header: ModPopupUIEvent, ModItemUIEvent, and ModLogoUIEvent. These are for being notified of whenever a mod popup is created, a mod list mod item is created, and a mod logo is created respectively.
You can listen to these events by using Geode’s events system as usual, using the EventFilter<T> helper class. Note that you should always return ListenerResult::Propagate to allow other mods to modify the layer as well, like calling the original in a $modify hook!
Guidelines
There are some guidelines on what you are and are not allowed to do when modifying the Geode UI. These are:- The mod may only access nodes by ID or member. No matching types or indices, if the node the mod wants to modify doesn’t have an ID and is not accessible by a member variable or direct class getter, the mod can not edit it
- The mod must always check for null on every node they access. It should never assume the existence of a node, even if it’s trivial
- The mod must safely handle all possible failure states, such as missing sprites. This includes failure states of other logic it runs; if the mod makes a web request, it must not crash on unexpected behaviour!
- If the mod finds any missing IDs, it must undo any/all of its changes and not make any more. The recommended way to do this is to first use
querySelectorto grab all the nodes in the scene it intends to modify beforehand, and then returning early if any of them are null - The mod must give all of its own nodes IDs prefixed by its mod ID and check beforehand if its nodes have been added on all events
Nodes nested inside other nodes don’t need to be prefixed, as long as the topmost parent is prefixed. For example,
my-mod.id/container > button is completely fair!