This is a simple script to take a screenshot and record the active application.
It takes a screenshot, and writes the current application name and title to a JSON file. Here's an example:
{
"cmd": "/usr/lib/gnome-terminal/gnome-terminal-server",
"date": "2017-02-14 17:50:01-05:00",
"window_name": "kale:~/dev/rc/capture-workspace"
}
Set it to a cron job!
*/5 * * * * DISPLAY=:0.0 ~/bin/capture-workspace
Setting the DISPLAY
variable is necessary as the cron job is run in a
different environment.
This depends on scrot(1), jq(1), and xdotool(1).
On Debian derivatives (like Ubuntu), they are in packages of the same names:
$ sudo apt install scrot jq xdotool