qutebrowser icon indicating copy to clipboard operation
qutebrowser copied to clipboard

Add commands to manage spellcheck dictionaries

Open The-Compiler opened this issue 7 years ago • 6 comments

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

The-Compiler avatar Jun 17 '18 18:06 The-Compiler

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 avatar Sep 18 '20 20:09 cizmazia

@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.

The-Compiler avatar Sep 18 '20 20:09 The-Compiler

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.

cizmazia avatar Sep 18 '20 21:09 cizmazia

Fair point. I'd really like to have something built into qutebrowser for managing dicts as well...

The-Compiler avatar Sep 21 '20 18:09 The-Compiler

Similarly to adblock-update, I would propose the spellcheck-update command that would install or update the dictionaries according to the spellcheck.languages configuration.

cizmazia avatar Oct 03 '20 11:10 cizmazia

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.

toofar avatar Apr 19 '24 23:04 toofar