Spellcheck in right click

No idea how difficult this would be, but it occurred to me entering data into a database, that lots of applications don’t have a spell checking function, and adding one seems to be a headache for a lot of them (SQLite frontends here being the example).

But all text has a way of getting into Plasma (or more properly the window manager, I believe - not sure). Anything text-based can be copied to the clipboard.

So if it were possible to hi-jack that mechanism for selected text, and run it through enchant/hunspell/aspell, with a simple Qt window for the GUI, we could have a spell-checker on everything - just right-click > ‘check spelling’ et voila… check the spelling on any selected text. Uses locale settings to select language.

the problem i see is getting selected text sent to an application to perform the spellcheck.

my distro is set up to middle click paste text into the sticky note widget (creates a sticky note on the desktop).

however, perhaps there is way to utilize this feature to send the text to a spellchecker widget instead, or perhaps we could get a spellchecker added to sticky notes.

in the meantime, as a hacky alternative, you can easily write an alias that would start kwrite in a manner like this

alias spl='
function spell-check() {
    if  [ ! -z $1 ]; then
        echo $1 | kate -i
        
    fi
};
spell-check'

and paste that into your ~/.bash_aliases file

then in a terminal type spl , then middle mouse paste the highlighted text into the terminal, and hit enter.

this will open an instance of kwrite where the word will appear as misspelled if not found in the main dictionary or your personal dictionary.

here you can use spellcheck on it and then copy the correct spelling so you can paste it back into your application that doesn’t have spellcheck.

another related problem is that the dictionary files for added words used by all the various apps that have spellcheck are scattered around the file system and use different formats—there is no single collector for all the user added words.

my solution was to make a script that collects all these dictionary files, extracts the words from them and puts them into a single file… then i use this file to deploy the words back into all the individual dictionary files so they are available in each application… a painstaking and tedious process.

but, now when i add a word using firefox it is now available (after a restart) for spellcheck in libre office or vise versa.

That’s what I thought. Right-Click ‘copy’ is already set up to take any selected text in any application to the desktop/window-manager. I’m not at all knowledgeable about the workings of the system here, but presumably, the Clipboard is a part of KDE/Wayland in some way - that’s what makes it globally accessible. So I thought if a very small spellchecker application was made, like Clipboard, it could check the spelling of selected text.

In fact - seeing as you’d have to somehow get the edited version back into the application it came out of - adding spellchecking to Clipboard seems to be the most obvious.

I can already view the contents of my clipboard, select lines from it, delete items from it… It doesn’t seem too much of a stretch to then be able to check the spelling of items in it.

Great idea, thanks.