Awesome
Client plugins for ManicTime
An example of how to create custom ManicTime client plugins. ManicTime client supports three different types of plugins:
- Tag source plugin
- Timeline plugin
- Tracker plugin
Tag Plugin
Within ManicTime a tag plugin can be used to:
- Get tags to ManicTime from an outside service
- Export created tag activities (tags with start and end time) to an outside service
There are two important files: ImportTags/TagsImporter.cs Here you can get your tags from any service and pass them to ManicTime as a collection of TagSourceItem objects.
ExportTags/TagsExporter.cs This will return a collection of TagActivity objects which you can then export to other services.
How to use
- Compile the project (source/tag-plugin).
- After you compile it, there should be a folder in repository root - installable-plugin/< BuildConfiguration >
- Go to ManicTime, Settings -> Advanced -> Open db folder
- Copy folder installable-plugin/< BuildConfiguration >/Plugin to database folder, so that in the database folder it looks like ....\db folder\Plugins\Packages\ManicTime.TagSource.SampleTagPlugin...
- Run ManicTime
If you go to Plugins, you should now see a new plugin
Click on Settings, to add new connection
Then go to Add tag, you should see some new tags
Make some tags, then export them
Timeline plugin
Timeline plugin can show data in ManicTime as a new timeline. Similar plugins shipped with ManicTime are Outlook calendar timeline, Google calendar timeline...
How to use
- Compile the project (source/timeline-plugin).
- After you compile it, there should be a folder in repository root - installable-plugin/< BuildConfiguration >
- Go to ManicTime, Settings -> Advanced -> Open db folder
- Copy folder installable-plugin/< BuildConfiguration >/Plugin to database folder, so that in the database folder it looks like ....\db folder\Plugins\Packages\ManicTime.TagSource.SampleTagPlugin...
- Run ManicTime
###For ManicTime timeline plugins:
- Open ManicTime
- Open Timeline editor (click on a Gear button above timelines)
- Click on Add timeline button
- Choose "Timeline plugin example"
- Select it and complete the wizard
- Timeline plugin example should now be added
Tracker plugin
Tracker plugin fills Documents timeline. When ManicTime detects an application, it gets the general data like process name, window title... Some applications also contain other data like URLs, open files, email sender... To get this extra data, ManicTime relies on plugins. When an application is detected, ManicTime will go through a list of plugins and try to get more data. We provide plugins for popular applications, like MS Office products and browsers, but you can write the plugin for any app you use.
In the sample we included two plugins, Notepad plugin and Outlook plugin. We suggest you take a look at Notepad plugin, it is simpler to understand. The important code is in file NotepadFileRetreiver.cs. You don't need to look at PluginTester project, its there to help you debug your plugin. If you will create your own plugin (not modify an existing one), add it to the list of plugins in file TrackActiveApplication.cs.
How to use
- Compile the project (source/tracker-plugin).
- After you compile it, there should be a folder in repository root - installable-plugin/< BuildConfiguration >
- Go to ManicTime, Settings -> Advanced -> Open db folder
- Copy folder installable-plugin/< BuildConfiguration >/Plugin to database folder, so that in the database folder it looks like ....\db folder\Plugins\Packages\ManicTime.DocumentTracker.Notepad...
- Run ManicTime
If it works ok, data should be visible on Documents timeline, when you use the application you wrote the plugin for.
Debugging in ManicTime
Client plugins (Tag plugin and Timeline plugin) can be difficult to troubleshoot or simply irritating to test manually.
One thing you can do, is attach debugger to ManicTimeClient.exe process.
To do this:
- Switch to Debug build.
- Open plugin project properties.
- Under Build property, "Output" section: edit "Output path:" relative to ManicTime's database folder. e.g. [ManicTime Database folder]\Plugins\Packages\ < PackageName >\Lib\
- Under Debug property, "Start action" section: pick "Start external program:" and set it to ManicTimeClient.exe executable (ManicTime.exe in case of TrackerPlugin). e.g. C:\Program Files (x86)\ManicTime\ManicTimeClient.exe
- Make sure ManicTime Client settings option "Settings -> General -> Keep user interface running when main window closes" is unchecked.
- Make sure ManicTime Client is not running.
- Press Start (F5) to start debugging
Starting project in Debug mode should open instance of ManicTime Client with debugger attached. Any breakpoints set in project should now be hit as the plugin code executes.