qmacro / thinking-aloud

A journal, of sorts.
13 stars 0 forks source link

2021-08-08 21:28:34 Revisiting my tmux workflow and journalling #28

Open qmacro opened 3 years ago

qmacro commented 3 years ago

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.

qmacro commented 3 years ago

This morning I tidied the script up and committed it to my dotfiles - you can see it here:

https://github.com/qmacro/dotfiles/blob/04a516e05b114753766f83d1234b2b4cc3051815/scripts/journal

I've added a key binding to my tmux config that requires me to hit "prefix Mod-j"; I'm still not sure how I want to organise the bindings yet and whether and when I use the Mod key, but this will be fine for now.