/RuneAPI-Swift

Developer API documentation for creating Rune plugins

Primary LanguageShell

Rune Developer API

For extending the functionality of Rune

Requirements: Theos

Getting Started

  1. Start by cloning this repo to your machine

  2. Run plugin-gen.sh to create a new plugin. It will ask you for some details before setting up the project.

Screenshot of plugin-gen

  1. cd into the newly created directory and compile the plugin using make package. If you are compiling for a rootless jailbreak, append THEOS_PACKAGE_SCHEME=rootless to the command.

  2. If the compilation was successful, you should have a .deb file in the packages directory. After installing the package and respringing, it should appear within Rune's panel selection.

Screenshot of a successful compilation

Screenshot of Rune's panel list

After enabling the plugin, you should see its panel show up within Rune.

Screenshot of the plugin in action

Programming

Now that you have a plugin set up, you can edit Tweak.x to build your UI and add functionality.

The plugin-gen.sh script creates a subclass of BBRBasePanelView for you automatically. This is the class that you should use to build your panel.

The didMoveToWindow method is called when the panel is (re)loaded by Rune. Use this to set up your panel's UI and any other initialisation code.

As each plugin is a Substrate tweak, you can hook methods just like you would in any other tweak.

NSNotificationCenter

Rune uses NSNotificationCenter to communicate with plugins. You can listen for notifications by adding an observer in your panel's didMoveToWindow method.

Here is an example of how to listen for the com.icraze.rune-opened notification, to call a method named updatePanel whenever Rune is presented:

[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(updatePanel) name:@"com.icraze.rune-opened" object:nil];

Available notifications:

com.icraze.rune-opened - Fired when Rune is presented

com.icraze.rune-closed - Fired when Rune is dismissed

Other Info

The icon field within the plugin's plist must be the name of an SF Symbol. Be sure to choose a symbol that is available on iOS 14 and above, as Rune supports these versions.