Native App for use with ContextSearch web-ext
This is a simple app written python that launches external applications from ContextSearch web-ext.
This app only runs when called by ContextSearch web-ext. It does not run when the browser is closed or when ContextSearch web-ext is not installed.
Be sure to install Python 3 before using the native app
Some browsers provide a different ID for the ContextSearch web-ext extension than what is listed in the browsers.json file. In these cases, you will need to add the alternative IDs to the allowed_extensions
or allowed_origins
keys and run the installer. In some cases, you may want to create an entirely new browser entry in the browsers.json
Download and run install.py
python3 install.py
To uninstall
python3 install.py --uninstall
Download ContextSearch.py and contextsearch_webext.json
Move files to desired location ( where mclovin is your user name )
mkdir "C:\Users\mclovin\AppData\Roaming\ContextSearch-webext"
move ContextSearch.py "C:\Users\mclovin\AppData\Roaming\ContextSearch-webext"
move contextsearch_webext.json "C:\Users\mclovin\AppData\Roaming\ContextSearch-webext"
and update your registry
Chrome
REG ADD "HKCU\Software\Google\Chrome\NativeMessagingHosts\contextsearch_webext" /ve /t REG_SZ /d "C:\Users\mclovin\AppData\Roaming\ContextSearch-webext\contextsearch_webext.json" /f
Firefox
REG ADD "HKCU\Software\Mozilla\NativeMessagingHosts\contextsearch_webext" /ve /t REG_SZ /d "C:\Users\mclovin\AppData\Roaming\ContextSearch-webext\contextsearch_webext.json" /f
Edit "path" key in contextsearch_webext.json to point to the python script. For example. if you moved ContextSearch.py to "C:\Users\mclovin\AppData\Roaming\ContextSearch-webext" your contextsearch_webext.json would look like:
{
"name": "contextsearch_webext",
"description": "Launch applications from ContextSearch-webext",
"path": "C:\\Users\\mclovin\\AppData\\Roaming\\ContextSearch-webext\\ContextSearch.py",
"type": "stdio",
"allowed_extensions": [ "{5dd73bb9-e728-4d1e-990b-c77d8e03670f}" ]
}
Chrome requires a slightly different manifest.json
{
"name": "contextsearch_webext",
"description": "Launches external application",
"path": "C:\\Users\\mclovin\\AppData\\Roaming\\ContextSearch-webext\\ContextSearch.py",
"type": "stdio",
"allowed_origins": [
"chrome-extension://lnojieghgnojlhmnfpmeidigmjpkppep/",
"chrome-extension://ddippghibegbgpjcaaijbacfhjjeafjh/"
]
}
Windows does not always recognize `ContextSearch.py` as an executable, and may not work unless called from a `.bat` file.
Create a new file named ContextSearch.bat
in the C:\Users\mclovin\AppData\Roaming\ContextSearch-webext
folder with the following content
@echo off
C:\Users\MYNAME\AppData\Local\Programs\Python\Python309\python.exe ContextSearch.py
change the Python path to wherever your python.exe is installed
Change the path
in contextsearch_webext.json
to "path": "C:\\Users\\mclovin\\AppData\\Roaming\\ContextSearch-webext\\ContextSearch.bat"
Download ContextSearch.py and contextsearch_webext.json
Make ContextSearch.py executable and move to desired location ( where mclovin is your user name )
mkdir /home/mclovin/bin
chmod +x ContextSearch.py && mv ContextSearch.py /home/mclovin/bin
Edit "path" key in contextsearch_webext.json to point to the python script. For example. if you moved ContextSearch.py to /home/mclovin/bin your contextsearch_webext.json would look like:
{
"name": "contextsearch_webext",
"description": "Launch applications from ContextSearch-webext",
"path": "/home/mclovin/bin/ContextSearch.py",
"type": "stdio",
"allowed_extensions": [ "{5dd73bb9-e728-4d1e-990b-c77d8e03670f}" ]
}
Chrome requires a slightly different manifest.json
{
"name": "contextsearch_webext",
"description": "Launches external application",
"path": "/home/mike/bin/ContextSearch.py",
"type": "stdio",
"allowed_origins": [
"chrome-extension://lnojieghgnojlhmnfpmeidigmjpkppep/",
"chrome-extension://ddippghibegbgpjcaaijbacfhjjeafjh/"
]
}
Move contextsearch_webext.json to the location required by the browser's NativeMessaging API
- Firefox:
~/.mozilla/native-messaging-hosts/contextsearch_webext.json
- Google Chrome:
~/.config/google-chrome/NativeMessagingHosts/contextsearch_webext.json
- Chromium:
~/.config/chromium/NativeMessagingHosts/contextsearch_webext.json
- Firefox:
~/Library/Application Support/Mozilla/NativeMessagingHosts/contextsearch_webext.json
- Google Chrome:
~/Library/Application Support/Google/Chrome/NativeMessagingHosts/contextsearch_webext.json
- Chromium:
~/Library/Application Support/Chromium/NativeMessagingHosts/contextsearch_webext.json