Domus

Periodic Writer

I don’t like to pick up a journal, search for the first new page, and write out about the day.
So I asked my laptop.

Actually I’m stuck on my laptop for a significant portion of my awake time, take it 60% or above on average. I have also heard that journaling is good for mental health, and quoting social psychologist James Pennebaker

Emotional upheavals touch every part of our lives. You don’t just lose a job, you don’t just get divorced. These things affect all aspects of who we are — our financial situation, our relationships with others, our views of ourselves. … Writing helps us focus and organize the experience.

So why not have a nagging journal just pop-up in every T timespan, where T is decided by your dedication frequency.

We’ll use crontab, your favourite terminal text-editor (Vim for me), and some scripts to run and compile your entries.
I’m assuming that you’re working on a Linux-based OS, I’ll update on the alternatives for Windows.

Writer

I chose my T to be 1 hour. A journal therefore should have space for seperate entry for each such time-slots, and ideally they should be hierarchially organised. I thought keeping a journal of the following format is more than enough:

year
└── date
    └── hour

So a script like the following should work fine:

Gist from GitHub

Now if you’ve not done already, and you should for automation again, create a user bin folder. What I’ve done is the following:

mkdir ~/bin
echo "export PATH=$PATH:/home/<username>/bin" >> ~/.bashrc
source ~/.bashrc

This means that any executable in that folder would now be directly accessible as a tool, using it’s name directly on the terminal. So put writer.sh as writer in the folder.

Crontab

Naturally I wanted a regular poking device that can slap the above script on my face, and came across cron.

The cron command-line utility is a job scheduler on Unix-like operating systems. Users who set up and maintain software environments use cron to schedule jobs, also known as cron jobs, to run periodically at fixed times, dates, or intervals.

Quite conveniently, use crontab -e to generate a file for your user’s personal schedules. Once inside, insert the following line:

# minute (m), hour (h), day of month (dom), month (mon), day of week (dow)
00 * * * * /home/<username>/bin/writer

Note the extra line at the end? That’s necessary for cron to detect your schedule. You can change your preferred scheduling by altering those numbers above.
Example, if you want to write every alternate day at 2pm

00 02 * * 1,3,5,7 /home/<username>/bin/writer

You may want to logout and login again for this to have affect.

Journal View

You might like to view what you wrote, just like you would want to review your journal.
Worry not, use the following:

Gist from GitHub

Run this script, choosing -type flag as md or txt. I recommend md (leave it default). Open the txt file, if you chose that, in LibreOffice Writer to convert it into a pdf.

Otherwise install grip using pip install grip, and do grip -b compiled.md that opens the journal in your browser, viewed exactly as it would on GitHub.

Keyring Pop-up

Due to the crontab trigger, I started facing a new pop-up saying Unlock your keyring.
To prevent this from happening, use:

rm ~/.local/share/keyrings/login.keyring

Conclusion

Congratulations! You’ll now be smacked every hour (or what your schedule requires you) by a journal page. Yes it’s interruptive sometimes, but that’s good for me, as it keeps track of time as well. Watching too many shorts? Smack!
Write down that you spent your last hour watching a giraffe falling over a tent, and you might not do that again.
Your journal is saved in ~/my_log as above, and generating a compilation is as easy as that. Enjoy!

convenience
cron