Skip to content

Latest commit

 

History

History
47 lines (36 loc) · 2.4 KB

README.md

File metadata and controls

47 lines (36 loc) · 2.4 KB

kdeautotext

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.

Requirements

kdeautotext depends on the following being installed and available on your system:

  1. KDE's clipboard manager, as included on Plasmashell 5.12.7. Other versions might work.
  2. KDE's kdialog. Tested on kdialog 2.0, others might work.
  3. jq json processor.
  4. GNU's gawk. It might work with other types of awk, but this has not been tested.
  5. 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.

Installation

  1. Clone the repo.
  2. Ensure all requirements above are met.
  3. Make sure kdeautotext.sh is on your path.
  4. Copy autotext.conf_sample.json from the repo to $HOME/.autotext.conf.json
  5. Go to KDE's system settings -> shortcuts -> Custom Shortcuts -> Edit -> New -> Global shortcut -> Command/URL.
    1. Rename the new action as 'KDE autotext'.
    2. On the trigger tab, select a shortcut to invoke auto-text.
    3. On the action tab, fill the Command/URL field with the path to kdeautotext.sh

Test your installation

  1. Open a text editor (Eg. kate).
  2. Press the shortcut key defined durint installation.
  3. Enter the text 'done' and press enter.
  4. Watch kate being filled with the text "This is my first kdeautotext test!".

Define your own text shortcuts and expansions

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.