Skip to content

Latest commit

 

History

12 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Open PDFs externally in Chrome

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.

How it works

  • The service worker watches for main-frame navigations to .pdf/.djvu URLs (chrome.webNavigation).
  • On match it sends the URL to the native host (wza_host) via chrome.runtime.sendNativeMessage.
  • wza_host pipes the URL through curl | zathura -.

Files

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)

Setup

  1. Load the unpacked extension from this directory in chrome://extensions.
  2. Note the extension's ID (shown on the extension card).
  3. Copy wza.json to ~/.config/chromium/NativeMessagingHosts/ (or ~/.config/google-chrome/NativeMessagingHosts/ for Chrome), replacing CHANGE_ME with the extension ID, and run chmod +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
  4. 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).

About

chromium extension to open PDFs externally with a custom script

Resources

Stars

2 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages