Pegasus supports calling external scripts and executables on certain program events.

1. The scripts directory

First, create a new directory called scripts inside the config directory:

2. Event directories

Inside the scripts folder, create a new directory for the kind of event you want to script:

quiton program quit
rebooton system reboot (also calls quit first)
shutdownon system shutdown (also calls quit first)
config-changedon the change of any configuration option
controls-changedon change of the control settings (also calls config first)
settings-changedon change of the regular (non-control) settings (also calls config first)
game-startbefore starting a game
game-endafter finishing a game

3. Script calling

Put your executable scripts or binaries into these new directories. They will be called in alphabetic order when the event happens.