A minimal manifest v3 extension that opens PDF/DjVu links in Zathura via a native messaging host.
Originally it used a custom wza: URL protocol, but Chromium M130 (the StandardCompliantNonSpecialSchemeURLParsing change) broke forwarding custom schemes from JS to the OS, so it now talks to the host directly instead.
- The service worker watches for main-frame navigations to
.pdf/.djvuURLs (chrome.webNavigation). - On match it sends the URL to the native host (
wza_host) viachrome.runtime.sendNativeMessage. - wza_host pipes the URL through
curl | zathura -.
| File | Purpose |
|---|---|
manifest.json |
Extension manifest (nativeMessaging + webNavigation permissions, service worker) |
background.js |
Detects PDF/DjVu navigation and forwards the URL to the host |
wza_host |
Native messaging host (Python): reads the URL, runs curl | zathura |
wza.json |
Native host manifest (template; see CHANGE_ME below) |
- Load the unpacked extension from this directory in
chrome://extensions. - Note the extension's ID (shown on the extension card).
- Copy
wza.jsonto~/.config/chromium/NativeMessagingHosts/(or~/.config/google-chrome/NativeMessagingHosts/for Chrome), replacingCHANGE_MEwith the extension ID, and runchmod +x wza_host:mkdir -p ~/.config/chromium/NativeMessagingHosts sed "s/CHANGE_ME/<extension-id>/" wza.json > ~/.config/chromium/NativeMessagingHosts/wza.json chmod +x wza_host
- Reload the extension.
The extension ID is derived from the unpacked directory path, so it stays stable across reloads (only changes if you move the folder).