You could do some of this with an input method editor (IME). It's pretty much an authorized keylogger that can edit your inputs, and is mainly needed for Chinese/Japanese typing. An IME that provides English autocomplete on the desktop (like phones) or shortcuts using an IME framework (like fcitx5) would be an interesting concept.