Language learning hack: Generate a "Word of the day" wallpaper
The best way to learn new words and phrases is to use them actively. The next-best way to learn new words is to be exposed to them as much as possible. And since the wallpaper that adorns my graphical desktop environment is what I stare at most of my waking hours, I thought that it'd only make sense to add words and phrases I want to memorize there.
Half an hour after the eureka moment, I had a working hack consisting of a plain text file with words and phrases along with their translations, a wallpaper template PNG file, and a simple Bash shell script. The latter pulls a random line from the text file, and uses the template to generate a new wallpaper with the picked line. Below are all the gory details worth knowing if you want to roll out something similar.
I use the hack on Linux Mint, but it should work just fine on any other graphical environment.
-
Install ImageMagick on your system. To do this on Linux Mint, run the
sudo apt install imagemagick
command. -
Prepare a plain text file with a list of words and phrases, and save it in your home directory. Create a wallpaper template. You can use an existing photo, or create your own masterpiece using something like Inkscape. The important part is to leave some space for the text in the upper part of the template. Save the template under the template.png name in the ~/Pictures directory.
-
Create a text file using your preferred text editor, and paste the following code into the file.
#!/usr/bin/env bash
if [ ! -x "$(command -v convert)" ]; then
echo "Make sure that ImageMagick is installed."
exit 1
fi
wordlist="vocabulary.txt"
template="$HOME/Pictures/template.png"
if [ -f "$wordlist" ] && [ -f "$template" ]; then
line=$(shuf -n 1 "$wordlist")
else
echo "Word list file and/or source wallpaper file is not found."
exit 1
fi
convert "$template" -gravity North -font Vollkorn-Regular \
-pointsize 50 -fill White -annotate +0+300 "$line" $HOME/Pictures/wallpaper.png
- Replace the default vocabulary.txt value with the actual name of the word list file. If a text color other than white would work best with the template, change
-fill White
to the desired color. You can also specify a different font by adjusting the-font Vollkorn-Regular
parameter. - Save the file under the wallpaper.sh name in the ~/bin directory (make sure that the directory is included in the PATH environment variable).
- Make the script executable using the
chmod +x ~/bin/wallpaper.sh
command. - Run the script to create a wallpaper.png file in the ~/Pictures directory, and set the file as the wallpaper.
- To make it easier to run the script when needed, assign a keyboard shortcut to it.
- From now on, whenever you run the script, the wallpaper should be updated automatically.
Finally, instead of assigning a keyboard shortcut to the script, you can create a cronjob that automatically updates the wallpaper periodically.