Zim

Creating Custom Link Handler

Asked by Shivam Sharma on 2017-06-28

Hi,

I am creating a plugin to integrate Zim with Zotero, a reference manager. I am stuck at one place. I am able to add references in Zim.

Now, when I click on those references in Zim, I want to run a function which will open that reference in Zotero. So, e.g. the format of link that I have created is: `zotero://link/to/reference`. Clicking on this link should initiate a function in my plugin which opens up that reference in Zotero.

How can I create custom link handlers?

Question information

Language:
English Edit question
Status:
Solved
For:
Zim Edit question
Assignee:
No assignee Edit question
Solved by:
Jaap Karssenberg
Solved:
2017-06-29
Last query:
2017-06-29
Last reply:
2017-06-29
Shivam Sharma (shivam-src) said : #1

The plugin is in working condition and available here: https://github.com/jaap-karssenberg/zim-wiki/wiki/Zotero-Plugin

You want to register an URL scheme with the main application object

https://github.com/jaap-karssenberg/zim-desktop-wiki/blob/2d0ead5a9736267766dfa669f2e78d27a2a5c110/zim/gui/__init__.py#L645

Best way would be to have a extension in you plugin for the mainwindow and then call "window.gui.register_urk_handler()"

Shivam Sharma (shivam-src) said : #3

Thanks Jaap Karssenberg, that solved my question.

Shivam Sharma (shivam-src) said : #4

The plugin is functional and available here: https://github.com/shivams/zim-zotero-plugin

People using Zotero can test the plugin, and report any bugs. The functionality is very minimal, but I will soon add more features.