Writing Plugins

Plugins for fman are written in the Python programming language (version 3.5). If you don't know Python, don't worry. It's really easy to learn.

A simple plugin

To write your first plugin, create a new folder called Hello World in the Plugins/User/ subdirectory of your data directory. Create the file Key Bindings.json in that directory, with the following contents:

[
	{ "keys": ["F3"], "command": "say_hi" }
]

Also create a subdirectory called hello_world in your new folder. Place a new file called __init__.py in that directory (i.e. in Plugins/​User/​Hello World/​hello_world/):

from fman import ApplicationCommand, show_alert

class SayHi(ApplicationCommand):
	def __call__(self):
		show_alert('Hello World!')

These are all the changes that are required. To apply them, open the Command Palette with Ctrl+Shift+P (or Cmd+Shift+P on Mac) and enter Reload plugins:

  • Reload plugins

When you then press F3, you should see the following dialog:

If it didn't work for some reason, please get in touch. We'll be happy to help!

The next page describes what just happened behind the scenes when you ran the plugin.