> moving between CLI and GUI domains

December 3, 2024

The usual graphical user interface and the terminal emulator are two very different modes of using a computer currently. GUI facilitates discovery, multitasking, ease of use (at the cost of software complexity). Meanwhile CLIs are (usually) simple, single task-focused but composable, with a high barrier of entry.

These modes, even with a long history of shared space on personal computers, intersect but only in isolated scenarios and inconsistently.

This is an evergreen note tracking all the different ways and patterns they can currently be used together:

launching a GUI program from CLI

Being able to launch a graphical program from the terminal is an obvious interaction (especially for any Linux users) that first comes to mind. A special callout would be a usage pattern any developer uses when launching their favorite code editor, which includes an explicit reference to a current directory:

code .
vim .
zed .

launching a GUI program, returning to stdout

A variation of the previous: this is where you launch a GUI window (browser, native or could even be another, temporary, TUI), you make some edits or add some information in that window, and then when the GUI flow closes the results of that are reflected in the returned stdout.

This is slightly hacky but useful when you want to extend coding agents. We use it in fp.dev with an fp review command.

  1. You launch a review flow from inside Claude Code prompt by running !fp review
  2. A GUI review screen boots up, you add your comments about the current state of the code
  3. You submit the review and the comments are piped back into the output of fp review so the agents immediately sees them in the context window.

drag to insert path

Another well-known is a reverse of the above when wanting to reference a file active in a GUI context (e.g. Finder) by dragging it to the terminal.

moving a file to a popover

I use Dropover daily (alternatives: Yoink). It is a temporary floating space anywhere on your screen that you can use to stash our file while you’re juggling between windows finding the right place you wanted to move or paste that file to begin with.

Turns out you can also use set up a terminal alias to send files from your terminal context to a popover window.

open -a Dropover <thing>

# set up an alias in fish

alias -s clip="open -a Dropover"

This is very useful for when I need to grab an artifact generated by a CLI program and drop it into a browser:

clip random.json
clip image.png