Do event listeners (file changes or keystrokes) exist for RStudio?



Is there any way to listen for events such as when a file in the editor is modified or saved, when keystrokes occur, or the mouse is moved in the RStudio window? I would like to create an addin/plugin for WakaTime and I would need to handle such events.

Alternatively, I might be able to do something using git diff, but event listeners would be prefered.

Thanks in advance.