Look up dictionary by using Right Click by Harpseal
Right click on text and show contextmenu to call external dictionary by using Uri scheme. dict:/// Uri scheme is supported by default on macOS. However, you can use a simple script to translate the Uri scheme for other dictionaries on other OS.
You'll need Firefox to use this extension
Extension Metadata
Screenshots
About this extension
Kindly reminded if your OS is not macOS, this addon can't work without a wrapper script to call the external dictionary software for safety reasons. The following guide require a little programming skills. Please check How-to-use for detail.
This addon is forked from another Firefox addon https://addons.mozilla.org/en-US/firefox/addon/mactionary
For more detailed description with pictures, please check the github repo of this addon. https://github.com/Harpseal/LookUp-Dictionary-By-dict-URI-Scheme
Update for firefox 84+ users
There is a new permission dialog to approve after firefox 84+.
Please open the Options page of this addon, check the checkbox, press the save button and try to look up some word. The temporary tab for dict scheme will not be closed and leave the permission dialog for user to approve.
After the permission is approved, please uncheck this checkbox in the Option page for normal use.
For more detail pleace check the How-to-use step4.
* How-to-use
When user right-click on any word on any website, the "Look up in dictionary" will appear in the context menu right away. Please select it, and this addon will send the clicked text or selected texts to the dictionary software which supports dict Uri scheme. (ex. dict:///keyword)
The dict:/// Uri scheme is supported by the build-in dictionary software in macOS. If your OS is Windows or Linux, please take the following steps:
For more wrapper script examples, please check the github repo of this addon. https://github.com/Harpseal/LookUp-Dictionary-By-dict-URI-Scheme
* Linux (python + GoldenDict)
Please replace the fullwidth space to halfwidth space before using the following python code.
* Windows (Autohotkey + GoldenDict)
This addon is forked from another Firefox addon https://addons.mozilla.org/en-US/firefox/addon/mactionary
For more detailed description with pictures, please check the github repo of this addon. https://github.com/Harpseal/LookUp-Dictionary-By-dict-URI-Scheme
Update for firefox 84+ users
There is a new permission dialog to approve after firefox 84+.
Please open the Options page of this addon, check the checkbox, press the save button and try to look up some word. The temporary tab for dict scheme will not be closed and leave the permission dialog for user to approve.
After the permission is approved, please uncheck this checkbox in the Option page for normal use.
For more detail pleace check the How-to-use step4.
* How-to-use
When user right-click on any word on any website, the "Look up in dictionary" will appear in the context menu right away. Please select it, and this addon will send the clicked text or selected texts to the dictionary software which supports dict Uri scheme. (ex. dict:///keyword)
The dict:/// Uri scheme is supported by the build-in dictionary software in macOS. If your OS is Windows or Linux, please take the following steps:
- Prepare the "wrapper script" before installing this addon. (require programming skills)
- Add dict:/// Uri scheme handler After some version of Firefox 57+, Firefox ignores all unknown URI scheme (ex.dict:/// on Win/Linux) and doesn't show the "Launch Application" window as before, so we have to add it by ourselves. In order to know how to deal with different types of files and URI schemes, Firefox have a internal list to save the action for each content type. The list is showed in Options->Applications. Unfortunately, even if user can change the actions in Options, Firefox doesn't support add or remove file types. We have to edit the list manually. Please take the following steps:
- Install this addon.
- Approve permission to run the wrapper script. (only for firefox 84+)
Prepare the "wrapper script" before installing this addon, because this script is the connection to the outside of the Firefox. There are some example scripts written in Python (for Linux users) and Autohotkey (for Windows users) in the end of this guide, and one more Copy/Paste Autohotkey example in the this addon's github page. The example scripts still need some customization. Please trace the scripts and customize for your system.
Python installed by default on Linux. If your OS is Windows, Autohotkey is recommended. Because Firefox only support to call EXE application on windows, you need to compiler the ahk script to EXE by using the Autohotkey compiler. Please download Autohotkey .zip from its website (https://autohotkey.com/download/) and unzip it, the compiler named Ahk2Exe.exe is in the "Complier" folder.
Before taking the next step, you should check the script is work properly. To test the script, you can execute in the terminal with with uri scheme as the only one parameter. Make sure the dictionary is showed with the word after the dict:/// correctly ("test" for example). ex:
C:\Tools> look_up_dict.exe dict:///test
2.1. Open your Firefox profile folder
Click the firefox menu button, click Help and select Troubleshooting Information. The Troubleshooting Information tab will open.
Under the Application Basics section, click on Open Folder. Your profile folder will open.
2.2. Close firefox
2.3. Edit "handlers.json"
Please copy a backup before editing.
Add "dict":{"action":4,"ask":true} in the end of json. Please check there are only three } in the end of file. ex.
...,"itmss":{"action":4,"ask":true},"gameon":{"action":4,"ask":true},"dict":{"action":4,"ask":true}}}[End-of-file]
After installation, your can try to right click on any text, the "Look up in dictionary" will appear in the context menu. If this is the first time you try to use this addon, a window named "Launch Application" (showed as the second screenshot) should open, please choose the script/exe which you make in the first step.
If the "Launch Application" is not showed (firefox's rule is changed again...), please open the firefox's Options and scroll down to "Applications" section (or search). The dict is should in the list with question mark. Open the dropdown menu and click Use other... to select your wrapper script.
Look up a keyword at the first time, the temporary tab for dict scheme will not be closed and leave the permission dialog for user to approve which is a new feature after firefox 84+.
If no temporary tab are shown and the wrapper script is not triggered, please open the Options page of this addon and check the checkbox to keep the temporary tab open.
After approving the permission, please uncheck the checkbox and click the save buttom in the Option page of this addon for normal use.
Kindly reminded that all add-ons will be disable in mozilla's add-ons website (https://addons.mozilla.org) and please try this addon on the other website after the installation is completed.
For more wrapper script examples, please check the github repo of this addon. https://github.com/Harpseal/LookUp-Dictionary-By-dict-URI-Scheme
* Linux (python + GoldenDict)
Please replace the fullwidth space to halfwidth space before using the following python code.
#!/usr/bin/python
import sys
import urllib
from subprocess import call
if len(sys.argv)>=2:
text = sys.argv[1]
if text.startswith("dict:///"):
text = urllib.unquote(urllib.unquote(text[8:]))
call(["/usr/bin/goldendict",text])
* Windows (Autohotkey + GoldenDict)
dict_path := "C:\Software\GoldenDict\GoldenDict.exe"
uriDecode(Str)
{
Static doc := ComObjCreate("HTMLfile")
Try
{
doc.write("<body><script>document.body.innerText = decodeURIComponent(""" . Str . """);</script>")
Return, doc.body.innerText, doc.body.innerText := ""
}
}
if %0% < 1 ; The left side of a non-expression if-statement is always the name of a variable.
{
ExitApp
}
Loop, 1 ; For each parameter:
{
param := %A_Index% ; Fetch the contents of the variable whose name is contained in A_Index.
StringLeft, url_scheme, param, 8
if (url_scheme = "dict:///")
param := SubStr(param, 9)
param := uriDecode(param)
Run %dict_path% %param%
}
Developer comments
Rate your experience
PermissionsLearn more
This add-on needs to:
- Access your data for all websites
More information
- Add-on Links
- Version
- 0.6.3
- Size
- 42.5 KB
- Last updated
- 2 years ago (Sep 25, 2022)
- Related Categories
- License
- The MIT License
- Version History
Add to collection
Release notes for 0.6.3
Fix bug to detect the current browser.
More extensions by Harpseal
- There are no ratings yet
- There are no ratings yet
- There are no ratings yet
- There are no ratings yet
- There are no ratings yet
- There are no ratings yet
The github repository of this addon:
https://github.com/Harpseal/LookUp-Dictionary-By-dict-URI-Scheme