Skip to content
Branch: master
Go to file
This branch is 5 commits ahead, 52 commits behind bharadwaj-raju:master.

Latest commit


Failed to load latest commit information.
Latest commit message
Commit time


Save keystrokes. Autocomplete, expansions and more — everywhere.

A utility to autocomplete words in the GUI.

TextSuggest supports multiple languages and extensions.

Want to contribute? See this.

Click the image to view a GIF demo.

TextSuggest in action

Licensed under the GNU GPL 3. TextSuggest is free as in freedom.


TextSuggest is a script that, when a keyboard shortcut is pressed, shows completions for the word selected or (optionally) currently being typed.

Then you can efficiently search for the right word with smart search (thanks to Rofi) and hit Enter to choose. Or Esc to exit.

An alternative background service, textsuggestd that intelligently offers completions when appropriate, without the need of pressing a shortcut is in development.


Ubuntu and Debian

Download textsuggest-git.deb

Now, see Post-install

Arch Linux

AUR (Arch User Repository): textsuggest-git, submitted by Daniel Sandman (shellkr)

Now, see Post-install


Make sure you have all the requirements (xdotool, xsel and rofi).

Run the included install script with sudo ./

Now, see Post-install


Bind the command textsuggest --auto-selection to a keyboard shortcut. Type a word, press the shortcut and ... TextSuggest will give you suggestions!

This offers the most basic use of TextSuggest. For more, see options and browse through the rest of this page.


If you installed it using packages, use your system's package manager.

Otherwise use sudo ./ --uninstall.


Also documented in the manual page: man textsuggest and --help.

  • -h, --help: Print out a help message.

  • --word word ...: Specify word to give suggestions for. If not specified, taken from X11 selection. Ignored if --all-words.

  • --all-words: Give all the suggestions. Then you can search through them etc.

  • --font font: Specify font to use for Rofi. Format: FontName (Weight) (Size). Default: Varies based on language.

  • --no-history: Disable the storage of frequently-used words in ~/.config/textsuggest/history.txt

  • --language languages ...: Specify language to use. Appropriate language will be detected if not specified. If detection fails too, English will be used.

  • --auto-selection [beginning|middle|end]: Auto-select word under cursor and suggest. See Auto-selection.

  • --no-processing: Disable use of processors

  • --rofi-options options ...: Specify additional options for Rofi.

  • --exit-if-no-words-found: Exit if no words are found (ERR_NOWORDS, return code 1) instead of restarting in --all-words mode (WARN_NOWORDS)

  • -v, --version: Print out version and license information.


TextSuggest can handle a range of expansions. It can also be extended.

Custom words

Simply add them to ~/.config/textsuggest/Custom_Words.txt like this:

custom=My custom Expansion!

and whenever 'custom' is typed, 'My custom Expansion!' will be inserted.


Inserts the output of a command:


when typed into a TextSuggest window, will insert output of ls.

Custom words + Commands

Add in ~/.config/textsuggest/Custom_Words.txt:

custom=#command --opts

and whenever you type 'custom' into TextSuggest, the output of command --opts will be inserted.


Simply type into TextSuggest:

%2 + 3

And '5' will be inserted. You can do any math expression that Python supports.

You can also use any function in the Python math library, for example %sqrt(25) for √25.

Custom Words + Math

Add in ~/.config/textsuggest/Custom_Words.txt:


And whenever you type 'custom' into TextSuggest, 5 will be inserted.


TextSuggest supports powerful processors for extensions.

A processor processes text before handing it over to TextSuggest to type it out. By default TextSuggest has two processors, command and math_expression.

You can see this in TextSuggest output:

$ textsuggest --all-words
Running in insert mode.
Chosen word: %2 + 3
Using processor math_expression from /usr/share/textsuggest/processors/
Processed: 5

Making your own extension

A processor is a simple Python script, that must define two functions, matches() and process(). Look into this example:

def matches(text):

	# Return whether this processor should process 'text' or not. (True or False)
	# For example, the command processor has it like this:
	#     return True if text.startswith('#') else False

def process(text):

	# Do something with 'text' and return it.
	# You *must* return a string.
	# This is what will be finally typed.

Make one based on the sample above, and place it in ~/.config/textsuggest/processors/ (file must end with .py extension).

Processors in ~/.config/textsuggest/processors take precedence over those in /usr/share/textsuggest/processors, in case of a name or match conflict.

You can set the order of loading of processors by creating a file called load-order.txt in the processor directory, which should have a newline-separated list of processors. The processors will then load in that order.

Other languages

English and Bangla dictionaries are provided by default.

For other languages, follow these steps:

  • Get a suitable dictionary/wordlist for your language. Search online for " wordlist" or " dictionary".

  • Put that dictionary into a text file in /usr/share/textsuggest/dictionaries with its name being your language's name and extension being .txt (English name, like "German.txt" instead of "Deutsch.txt").

  • A suitable font should be auto-detected. If not, pass a suitable font with the --font option.

  • Language should be auto-detected. If not, manually set language using the --language option.

Auto-select and suggest

This feature allows you to get suggestions for the word being typed, without having to select it. Save more keystrokes!

Using it

Pass the --auto-selection option to TextSuggest.

Additional options

You can change the way --auto-selection selects words.

  • Add beginning to --auto-selection to assume that text-cursor is at beginning of word.

  • Add middle to --auto-selection to assume that text-cursor is in the middle of word.

  • Add end to --auto-selection to assume that text-cursor is at end of the word. This is the default.


TextSuggest offers powerful search, thanks to Rofi.

It has:

  • Fuzzy search: No need to type the complete word. Just type parts of it (separated by spaces).
  • Globbing: Use wildcards like ?, * etc.


  • ERR_NOWORDS: Caused when no suggestions are found. Return value: 1. NOTE: Suppressed and program restarted in --all-words mode unless --exit-if-no-words-found is passed.

  • ERR_REJECTED: Caused when TextSuggest is cancelled by user (for example, by pressing Esc). Return value: 2.

  • ERR_EXPRESSION: Caused when evaluating a math expression results in a Python error. (Usually SyntaxError). Full traceback of said error is writted to stderr. Return value: 3.


Internally, TextSuggest has two modes:

  1. Provides completion for a specific word: replace mode.
  2. Provides a list of all words: insert mode.

You will see this in TextSuggest output:

$ textsuggest
Running in replace mode.


textsuggestd is a work-in-progress background service that automatically launches TextSuggest when appropriate.

It is an effort to achieve TextSuggest's final goal: to be like the suggestions on mobile phones, which appear without stealing focus and disrupting typing, and without having to press shortcuts.

WARNING: It is currently unusable. Do not run. However, if you want to alpha-test, see below.

Running textsuggestd

WARNING: It is currently unusable. Run at risk. See escaping.

Simply do:

$ ./textsuggestd &

Escaping textsuggestd

Get to a terminal somehow (TTY, maybe?) and run:

for i in $(pgrep python3); do
    ps -fp $i | grep 'textsuggestd' && kill $i


Simple Linux utility to autocomplete words in the GUI




No releases published
You can’t perform that action at this time.