Hacking Positivity

· 2 min read

I had spent five months of my life and bit the proverbial bullet on a $6000 “COVID tax” but I had finally made it to Taiwan. Enamoured by new experiences and excitement for all that is to come — I let my daily habits slip — and I didn’t handle it well.

I forgot how low my mind was capable of going. Armed with the tools from digging myself out of this mess in the past, I knew what needed to be done, but taking the initiative to make the changes became increasingly difficult as the pull increased in strength over time. Nevertheless, I persevered.

Part of my morning routine includes reading over positive affirmations. In times of mental crisis, I need reminders throughout the day. Sticking post-it’s around my room as a reminder sound like a great idea — and I do it — but in practice they get ignored as I choose to transmute pain into creativity on my computer, ignoring anything beyond the narrow view of my laptop.

I have been building a document containing mantras, positive affirmations, and ideal ways to live by. Aptly named reprogramming.md, I often refer to it as a means of reprogramming my mind. There are days that I don’t feel motivated enough to open the document and those are when I need it the most. I needed way to recall them without effort — so I built it.

I started by writing a simple script that reads a random line from a text file and optionally display a system notification with the contents instead of outputting to the terminal.

#!/usr/bin/env sh

# usage: recall [-n] [-f <filename>]

filename="$XDG_CONFIG_HOME/recall.txt"

while getopts ":hf:n" arg; do
  case $arg in
    f)
      filename="$OPTARG"
      ;;
    n)
      is_notify="1"
      ;;
    h)
      echo "Usage: recall [-n] [-f <filename>]"
      exit 0
      ;;
  esac
done

line="$(shuf -n 1 "$filename")"

if [ -z $is_notify ]; then
  echo "$line"
else
  notify-send -u critical 'Recall' "$line"
fi

Next, I wrote a wrapper script that will only send the notification if I have been using my computer within the past fifteen minutes.

#!/usr/bin/env sh

if [ "$(xprintidle-ng --format '%tsci')" -gt 15 ]; then
  exit 1
fi

recall -n

Finally, I configured a systemd service and timer to be run under NixOS.

systemd.user.services.recall-if-active = {
  description = "recall-if-active";
  serviceConfig = {
    Type = "oneshot";
    ExecStart = "%h/usr/bin/withenv %h/usr/bin/recall-if-active";
  };
};

systemd.user.timers.recall-if-active = {
  timerConfig = {
    OnCalendar = "*:0/15";
  };
  wantedBy = [ "timers.target" ];
};

There was no need to overengineer it. I simply wanted the tool for the utility it provides and a short break from my primary project to keep things fun and playful.

I find great joy in writing tools to fill gaps in my life. I am feeling happy and positive again, choosing to live from a state of abundance over scarcity. The little notification pops up and reminds me of the path I’m on. I smile, dismiss it, and carry on.