i3 Desktop Part 7: Notes and a Scratchpad Terminal

Two features improve my daily i3 workflow: notes and a scratchpad terminal.

Both features are simple. This simplicity makes them effective.

The notes are Markdown files under ~/.local/share/notes. The scratchpad terminal is a floating kitty window managed by i3. Scripts wrap both features. They behave like desktop components. I do not need to remember separate habits.

Markdown notes

.local/bin/i3-notes handles the notes.

The menu contains these actions:

  • quick note
  • open today
  • open scratch
  • search notes
  • recent notes
  • browse notes
  • open notes folder

I use “quick note” to capture information without switching context. It opens a rofi input prompt. It appends the note to today’s daily Markdown file with a timestamp.

Daily notes live under daily/YYYY-MM-DD.md. If the file does not exist, the script creates it. It adds a heading with the current day and date.

This provides a lightweight log. I do not need a full journaling app.

Opening notes in the terminal

When opening a note, the script prefers a terminal editor. It tries nvim, then vim, then vi. It uses these unless I3_NOTES_EDITOR is set. If kitty is available, it opens a kitty window in the note’s directory. It runs the editor there.

This fits my desktop. Notes are plain files. I edit them in tools I already use. There is no sync service, database, or custom format.

Search uses rg when available. It falls back to grep. Results appear in rofi. Selecting a result opens the file at the matching line for vim-style editors.

Recent notes are based on file modification time. Browse notes lists Markdown and text files under the notes directory.

This is not a knowledge management system. It provides fast capture and fast retrieval.

The scratchpad terminal

The scratchpad terminal is .local/bin/i3-scratchpad-terminal.

The i3 config marks windows with instance scratchpad-terminal as floating. It sets them as sticky and centred. It resizes them to 1200 by 720,. It moves them to the scratchpad. Mod+Shift+Return toggles it.

The opening location is a useful detail.

When launching a new scratchpad terminal, the script finds the working directory of the focused window. It asks i3 for the focused window ID. It uses xprop to get the window PID. It walks descendant processes with ps. It reads /proc/<pid>/cwd.

If it finds a useful directory that is not home, kitty opens there. If not, it falls back to $HOME.

If I work in a terminal inside a project and hit the scratchpad shortcut, the scratchpad starts in that project. It acts as a temporary command layer over my current work. It is not a random terminal.

Why use i3 scratchpad

The scratchpad gives a window a different lifecycle. This makes it one of the best i3 features.

Most terminal windows belong to a workspace. The scratchpad terminal belongs to the desktop. It appears on top of my current task. It disappears without changing the workspace layout.

It is ideal for:

  • quick commands
  • checking a file
  • running a one-off search
  • testing a command before adding it to a script
  • taking a note while staying in the same workspace

It does not replace normal terminals. It acts as a pressure valve.

Plain files, fast entry

The notes script and scratchpad terminal share the same philosophy.

Do not add a large app when a plain file and a good shortcut are enough. Do not make capture depend on a browser tab or a cloud service. Do not let quick commands disturb the workspace layout.

The desktop should make small actions cheap.

For me, notes and scratchpad are low-friction tools. They help me keep working without losing context.