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 .

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

< Back