Darrell Dupas - March 06, 2026, renedupas@proton.me
display random translations as a learning tool
When I pick up a real dictionary my urge is to find a random word. Well, That urge was not satisfied with dict.
Warning
this is my first rust project
Dicter looks up random definitions from one of the freedict dictionaries you've installed. The default is english to french translation.
Note
dicter is designed to be used as a swaybar status_line but can be used in the terminal
For this program to work you must have the dictd service running. You also need to have whatever dictionaries installed. So, if you want the default, install freedict-eng-fr.
The weird thing about dicter is it is actually 2 programs, and I am not sure if I would build it this way again, the main reason I thought, was to have the random phrase generator always have all its phrases in memory and the dicter be light, and could just be re run often with low memory footprint connecting to the phrase generator. Dicter runs randphase, but it must be in your system path, usually ~/.local/bin, which is the biggest annoyance about splitting the 2 parts, as a monolith there would be no socket required as well, so, yes I have regrets.
There are positives, the first being the jobs that each do are isolated. The second, unlikely benefit is that multiple instances of dicter will share one randphrase.
systemctl start dictd
sudo apt install dict-freedict-fra-eng
dicter --dict freedict-fra-eng
nc localhost 2628
HELP
Dicter is designed to be used as a status_line for swaybar. In your ~/.config/sway/config file you would use:
bar {
status_command dicter
}
Note
Troubleshoot running swaybar from a terminal with -d
Tip
Troubleshoot dictd with dict first
Warning
Do not use the interval parameter in waybar, use the interval parameter to dicter instead. dicter does not want to be rerun over and over
dicter --interval 1
apt search dict-freedict
apt install dict-freedict-gle-eng dict-freedict-eng-gle
dicter --dict freedict-gle-eng
--dict <name>: Freedict dictionary name (example:freedict-fra-eng).--interval <secs>: Seconds between updates (default10).--pronounce: Keep/.../pronunciation segments in output (default is off; when off, dicter replaces/.../with-).
there is an additional program in this workspace called scroller which you can use to limit the width, the parameters are --duration_ms, which should match the interval of dicter, dicter's interval is how often a word changes, and srollers duration is how often it looks for new things to scroll, so they should match on the pipeline. scrollers' --interval_ms is is how often the letters move.
dicter --interval 10 | scroller --duration_ms 10000 --width 30 --interval_ms 250
also, keep in mind that waybar uses sh, NOT BASH, to exec, therefore, setting your path in .bashrc will not help you in your waybar config, hence, I just use full paths in config.json like so:
"custom/dicter": {
"exec": "/home/dd/.local/bin/dicter --interval 10 | /home/dd/.local/bin/scroller --interval_ms 100 --duration_ms 10000 --width 30",
}
There is an additional, optional parameter called chop, default value 5. When
the line is less than width + chop, instead of scrolling that little bit,
we just truncate to width and do not scroll.
-
--width <cols>: Output width in terminal columns (required). -
--duration_ms <millis>: Total time to animate each incoming line (required; usually match dicter--interval). -
--interval_ms <ms>: Time between animation frames in milliseconds (required). -
--chop <n>: If a line is only slightly longer than--width(≤width + chop), truncate instead of scrolling (default5). -
--start-delay <secs>: Delay before starting scroll motion (only when scrolling) (default2). -
--switch-delay <ms>: Pause when scroll direction changes or wraps around (default0). -
--mode <mode>: Scroll mode. Available modes:dicter-default(bounce),inner-bounce,wrap-around,jump-to-start,over-left-edge,over-right-edge,marquee. Default:dicter-default. -
--delay <secs>: Alias for--start-delay(for backward compatibility). -
other note, could add a slashr option to dictd and slowcat to use /r instead of /n, but /n is default, but /r could be nice too, i think for non debugging purposes /r in the terminal would be best, but for debugging obviously /n is better
-
far in the future feature ansi animations added to scroller, meh
-
all modes only apply to the inner content area not the padding
-
add a no-padding option
-
every duration param needs to be milli seconds need to clean up param names interval and duration being vague and how they relate to each other between the bins
-
some modes need to have behavior defined for 2 cases, the case when the text is wider than width, and when they are narrower than the width.
-
start-delaymili wait before scroll starts -
switch-delaymilli wait before change directions or loop around end, whatever makes sense -
repeat-countvalid values: 0..MAXINT or FOREVER or INFINITY
-
dicter-default: when narrower sit still right aligned. when wider start left aligned and scroll to the left until the right-most letter hits the right edge, then change directions and go back to the start -
inner-bounce: The left edge of the text hits the inner-left edge and stops; the right edge of the text hits the inner-right edge and stops; then it reverses direction. (this is the same as dicter-default unless the text is less than width, inner-bounce will have short text scrolling back and forth) -
wrap-around: Letters always move left; when the view passes the last letter, the start of the string wraps around to the back and continues (continuous marquee). -
jump-to-start: Scroll left until the end is reached, then jump back to the start (left-aligned) and repeat. -
over-left-edge: Leftward flow with “off-screen” space. Start with the text fully off-screen to the right (window initially empty), let it flow into the window, then flow out past the left edge, then wrap around and repeat (same direction). -
over-right-edge: Rightward flow with “off-screen” space. Start with the text fully off-screen to the left (window initially empty), let it flow into the window, then flow out past the right edge, then wrap around and repeat (same direction). -
marquee: Text starts fully off-screen to the right (window initially blank), flows in from the right edge, scrolls across to the left, flows out past the left edge, then repeats. Each cycle starts with a blank window. A test is available intester.nuwith 20 cycles.


{ "modules-left": ["hyprland/workspaces","hyprland/window"], "modules-right": ["custom/dicter","pulseaudio","clock"], "clock": { "format": " {:%H:%M}" }, "pulseaudio": { "format": "{icon} {volume}%", "format-icons": { "default": ["", "", ""] } }, "battery": { "format": "{icon} {capacity}%", "format-icons": ["", "", "", "", ""] }, "custom/dicter": { "exec": "/home/dd/.local/bin/dicter --interval 3" } }