DJ Adams

Revisiting my tmux workflow and journalling

Rebuilding the journalling script to open the editor first, then prompt for a title, and launch it all from a tmux popup.

Originally a short post in the Thinking Aloud journal.

I've been learning lots about tmux over the last few days, both from long time friend Rob Muhlestein and latterly from Waylon Walker. So much so that I am at the state where I want to refresh my workflow which is based upon it. New and improved key bindings, better use of sessions, and looking at employing popups, a new feature introduced with tmux version 3.2.

I'm writing this journal entry within a popup; I've re-jigged the j function to become a more fully fledged journal script that I can then invoke with a key binding in tmux, which will then launch the script in a popup, like this:

tmux display-popup -E journal

The journal script is still very raw (I'm even writing it on a machine that doesn't have shellcheck installed yet, shame on me) but this is what it looks like so far:

#!/usr/bin/env bash

declare tmpfile repo title
tmpfile=$(mktemp /tmp/journal.XXXXXX)
repo="$HOME/Projects/gh/github.com/qmacro/thinking-aloud"

vim "$tmpfile"\
&& cd "$repo" \
&& echo -n "Title? " \
&& read title \
&& [ -n "$title" ] \
&& gh issue create \
  --label entry \
  --title "$(date '+%Y-%m-%d %H:%M:%S') $title" \
  --body-file "$tmpfile"

So for those who have seen how I've created journal entries thus far, the main difference here is that I'm opening up the editor first, then asking for a journal title, and only if I get both do I use gh issue create as I have been doing already (but this time, taking the issue body from the temporary file I've just created and edited).

I've just realised I should clean up that $tmpfile too. By the time this script hits my dotfiles repo, I'll have added that, and also tidied it up a bit more.

I like the idea of writing a journal entry in a modal popup; I'm pondering whether I should do it in the context of a (new) tmux session, so I can switch back into a half-written journal entry later, but I also like the idea that a journal entry should be short - certainly short enough for a single popup session. So that's what I'm doing right now.

Let's see how it goes.