Add commands to manage spellcheck dictionaries
Split off from #3759, also see #3762 and #2939.
Currently we have a separate dictcli.py to manage dictionaries. However, with Qt 5.10 we can install dicts without root rights, so we should have some way to manage them from inside qutebrowser.
First idea for commands:
-
:dict-install(ideally with autocompletion) -
:dict-install --update -
:dict-remove -
:dict-remove --old
Could this get a higher priority, so that prebuilt installations may use spellchecking?
Without commands for installing dictionaries, the users are forced to build from source only to download dictionaries for spellchecking using dictcli.py. For this reason, the users cannot simply use Flatpak or install from repositories.
Workaround
Determine the filename:
curl -fsL https://chromium.googlesource.com/chromium/deps/hunspell_dictionaries.git/+/master/?format=JSON | grep 'en-US'
The target folder is in qutebrowser's data folder listed in the Paths section of :version.
Linux
curl -fsL https://chromium.googlesource.com/chromium/deps/hunspell_dictionaries.git/+/master/en-US-9-0.bdic?format=TEXT | base64 -d > ~/.local/share/qutebrowser/qtwebengine_dictionaries/en-US-9-0.bdic
Mac
curl -fsL https://chromium.googlesource.com/chromium/deps/hunspell_dictionaries.git/+/master/en-US-9-0.bdic?format=TEXT | base64 -d > ~/Library/Application\ Support/qutebrowser/qtwebengine_dictionaries/en-US-9-0.bdic
@cizmazia What do you mean with "prebuilt installations" and "built from source" exactly? Unless you mean the macOS/Windows binaries, you can just download and run dictcli.py.
Thanks for your response!
Most recently, I have installed Qutebrowser on macOS:
brew cask install qutebrowser
dictcli.py imports from qutebrowser and requires PyQt5:
Traceback (most recent call last):
File "scripts/dictcli.py", line 38, in <module>
from qutebrowser.browser.webengine import spell
File "scripts/../qutebrowser/browser/webengine/spell.py", line 29, in <module>
from PyQt5.QtCore import QLibraryInfo
ModuleNotFoundError: No module named 'PyQt5'
To resolve this, I tried to mkvenv.py but ran into some issues I have not managed to resolve.
Fair point. I'd really like to have something built into qutebrowser for managing dicts as well...
Similarly to adblock-update, I would propose the spellcheck-update command that would install or update the dictionaries according to the spellcheck.languages configuration.
I was going to raise an issue about making dictcli support basedirs (eg by having a -B arg or looking at the QUTE_DATA_DIR env var when run as a userscript). But this issue is probably the right direction and almost-tiny, so may as well promote this instead.
I also support the proposal from @cizmazia, of a single command that just makes sure the installed dictionaries match the spellcheck.languages settings. I'm not convinced this needs multiple commands to manage.