Text expander based on KDE's Klipper
This tool allows you to expand pre-configured short texts into longer text, with optional replacement of a placeholder with the current contents of your clipboard. Eg. You type in 'done' and what gets typed into your window is 'Done in commit '.
I built this as a quick hack, so don't expect a lot of updates or maintenance. Contributions are welcome.
kdeautotext depends on the following being installed and available on your system:
- KDE's clipboard manager, as included on Plasmashell 5.12.7. Other versions might work.
- KDE's kdialog. Tested on kdialog 2.0, others might work.
- jq json processor.
- GNU's gawk. It might work with other types of awk, but this has not been tested.
- xdotool 3.20160805. Other versions might work.
In addition, it uses qdbus
, which is expected to be available just by the fact that you are running KDE applications.
Notice that kdeautotext expects Ctrl + V
to be the shortcut for pasting text.
- Clone the repo.
- Ensure all requirements above are met.
- Make sure kdeautotext.sh is on your path.
- Copy autotext.conf_sample.json from the repo to $HOME/.autotext.conf.json
- Go to KDE's system settings -> shortcuts -> Custom Shortcuts -> Edit -> New -> Global shortcut -> Command/URL.
- Rename the new action as 'KDE autotext'.
- On the trigger tab, select a shortcut to invoke auto-text.
- On the action tab, fill the Command/URL field with the path to kdeautotext.sh
- Open a text editor (Eg. kate).
- Press the shortcut key defined durint installation.
- Enter the text 'done' and press enter.
- Watch kate being filled with the text "This is my first kdeautotext test!".
kdeautotext expansions are configured through templates in .autotext.conf.json. It is a simple JSON with the form
{
"shortcut1": "expanded text 1",
"shortcut2": "expanded text 2"
}
Notice that any occurrence of the string ___PLACEHOLDER___
on the expanded text template is replaced by the current contents of your clipboard. The default config file has a few examples. Add yours as desired.