Hey, I’m Darren. I’m a software engineer from Scotland who enjoys working on open source projects. I specialise in Python and writing developer tools which run in the terminal. My most well known projects are Posting, a modern HTTP client which runs in the terminal, and Elia, a TUI for interacting with local and proprietary LLMs. This site is a collection of tips, tutorials, random thoughts, and anything else I feel like writing about!

Custom keymaps in Textual


Textual 0.82.0 adds support for keymaps, which make it easy to customise keybindings based on config or user preferences.

Keymaps allow you to swap the keys associated with a Binding at runtime with a single method call.

  • You could switch to a Vim keymap if a user of your app enables “Vim mode”.
  • You could read a keymap from a file on the users drive and swap it in on app startup.
  • You could swap the increment and decrement keys on April 1st!

The possibilities are endless!

Read more ⟶

Copying and pasting in Textual


Terminal emulators are in general quite limited when it comes to copying and pasting. Fortunately, when writing Textual apps, we have a few options available to us.

Textual’s built-in support

Textual’s App class has a method called copy_to_clipboard(text: str). Pass a string into it, and that string will be placed onto the clipboard of the machine your terminal emulator is running on (if your emulator supports it).

Unfortunately, if the user of the app is running in MacOS Terminal.app or another unsupported terminal, nothing will happen.

Read more ⟶

Let's get fractional! Textual layouts with fr units


Fractional units (fr) are a tool in Textual’s CSS system which lets you distribute space between child widgets inside a container in a really intuitive way.

I use them everywhere in my Textual apps, but I get the feeling that they may be a little under-appreciated.

fr units make it easy to implement many common layout patterns, and have some less obvious benefits too!

Let’s explore how fractional units work in Textual, along with some practical examples!

Read more ⟶