Components
Extension Files
Native Host Files
How It Works
- Extension → Native Host: The extension calls
chrome.runtime.connectNative()to open a persistent connection. - Message Format: JSON messages prefixed with a 4-byte length header (standard Native Messaging protocol).
- Native Host → System: The Python script receives the JSON command and executes it via
subprocess.Popen(). - Response: The native host sends a JSON status message back to the extension.
Customization
Editnative_host.py to launch different applications, execute custom commands, process files before opening, or return richer status information — the extension shell stays the same.