A pop-up dictionary with sdcv

September 17, 2025

For years I’ve used StarDict, but it seems to have been abandoned, and not everything works as well as it used to (I can’t set a custom font anymore, for example). There are some alternatives (like qstardict, goldendict), but all have something I dislike enough not to switch to them.


In the past, I’ve occasionally used sdcv, a command-line application that lets you search stardic dictionaries. I’ve recently switched to this exclusively, and found a way to use it that makes it far superior to all the others, including the original StarDict.


The dictionary window is only necessary when you need to look something up. StarDict and its ilk have a “scan” feature, that lets you look up any word you’ve highlighted. I tried that feature several times, but also found it clunky to use (especially since I mostly use StarDict for Sanskrit dictionaries, and since Sanskrit declines its nouns and conjugates its verbs, you almost never want to look up the word that is in the text you are reading).


With sdcv I can do this much better. Here’s how:


I created a script that uses zenity in which I can type the word I want to look up, and then launches a terminal to display the entry in sdcv. That script is then tied to a keybinding in my Openbox rc.xml (W-s), so I can look up something almost instantly.


This is the script:

!/bin/sh
# Use zenity to search for words in sdcv
SANSKRIT=zenity --entry --title="Look up"
\ --text="What should I look up?"
urxvt --geometry 75x45 -e sh -c "sdcv '$SANSKRIT' | less"


If you use xterm, that last line could just be xterm -e "sdcv $SANSKRIT | less" (i.e. without invoking sh), but that does not work with my terminal of choice, urxvt, for reasons I don’t quite comprehend.


Unlike many other cli applications, sdcv doesn’t quite launch properly when you don’t run it in an already open terminal (urxvt -e sdcv launches sdcv and then terminates it immediately). So you need to use less to view the result of your search.


Obviously, this doesn’t work when you are not sure what you are looking for: you don’t get a list of possible options. It requires you to know what word in the dictionary you want to see. If that is not the case, you’ll need to launch sdcv normally, in an open terminal.


This doesn’t bother me, since this method suits my needs 96.5% of the time, and has the benefit that 1) looking something up is so much faster now, and 2) I don’t need to have an extra window open; I can call up a dictionary whenever I need it, and when I don’t doesn’t need to run in the background.

Design a site like this with WordPress.com
Get started