fun with custom fortune files

coding

i have a dashboard homepage, powered by glance. it shows me a lot of stuff, well, at a glance: standard stuff like the date/time/weather/etc, and then uptime for my most important sites, some fun lastFM widgets, and more. important to this post, it shows a feed of the latest posts on lobsters, a forum that asks and answers the question of "what if hacker news didn't suck shit." sometime last night, i saw a post pop up in the lobsters feed: using fortune to reinforce habits by judy2k.

in that post, judy2k describes creating a custom data file for the old and iconic UNIX program known as fortune, which takes data files that can contain a bunch of strings, and simply shuffles and shows one at random when you run fortune (and supply the relevant data file's name, if you want that specific one). judy2k uses it as a "habits" thing, reminding him of cool programs and fun stuff that he wants to make a habit of using. this is shown to him every time he opens a new terminal window— it's integrated in the shell!

i was SUPER inspired by judy2k's use of fortune as a sort of reminders/habit-enforcing system. i thought it was really clever! and i've loved fortune for a while, since the short time i ran a gotify instance and had random 1990s-era UNIX/linux fortunes pop up as notifications every so often.

that thought of notifications was like a light-bulb moment for me. i thought, why don't i do the same thing, but with notify-send? and i'm happy to report that i indeed did so!

all i did was follow the steps to create a custom fortune file laid out by judy2k in his blog post, including the make-file. (by the way, that's a really neat use of make-files and now i want to try using those more.) once i had a decent amount of reminders compiled, i put together a very simple script:

#!/bin/bash

frtn=$(fortune ~/.local/fortune/reminders)

notify-send "reminders" "$frtn"

it's seriously that simple LMAO

after that, i made two user-level systemd files: one is a service, and the other is a timer that runs the service every 30 minutes:

frtn-reminders.service:

[Unit]
Description=Regular reminders.
After=network.target

[Service]
Type=simple
Environment="DISPLAY=:0"
ExecStart=/home/kat/.local/bin/frtn
Restart=unless-stopped

[Install]
WantedBy=multi-user.target

frtn-reminders.timer:

[Unit]
Description=Run frtn every 30m

[Timer]
OnBootSec=15min
OnUnitActiveSec=30min
Unit=frtn-reminders.service

[Install]
WantedBy=timers.target

after the systemd-typical enable & start dance— or rather, a typical fight with systemd and then the enable & start dance— i had a notification pop up on the first real run!

since then, i've had a rotation of little fortune-based reminders pop up every half hour. i've shared the file in my dotfiles; a lot of these are personal to me, so i recommend you either adapt the file to suit your own needs, or make your own altogether.

i hope this post encourages you to have just as much fun with fortune as i did!


Comment Form is loading comments...