strata
Documentation menu

Shell integration

Quit into a directory

A program cannot change its parent shell's directory, so strata comes with a small shell function. Once it is installed, Q quits and leaves your shell in the directory you were browsing. Plain q leaves it where it was — or set cd_on_quit = true to always follow.

Add one line to your shell's config:

# bash — ~/.bashrc
eval "$(strata --shell-init bash)"
 
# zsh — ~/.zshrc
eval "$(strata --shell-init zsh)"
# fish — ~/.config/fish/config.fish
strata --shell-init fish | source
# PowerShell — $PROFILE
Invoke-Expression (& strata --shell-init powershell | Out-String)

The function is called strata and wraps the real binary, so you keep typing strata as usual.

Running commands

KeysAction
!Open your $SHELL in the current directory (in a Docker container or over SSH for remote locations)
:sh <command> or :!<command>Run a command here and see its output
:each <command>Run a command once for each marked item
:git <args>Run git here (no arguments: the git menu)

Commands can name the marked items (or the hovered one when nothing is marked) with placeholders. strata quotes them for the shell:

PlaceholderStands for
{f}The first marked item's path
{s}Every marked item's path
{n}The first marked item's name
{d}The current directory
:!tar czf backup.tgz {s}        one archive of everything marked
:each ffmpeg -i {f} {f}.mp3     one command per marked item
:each gzip -k                   no placeholder: the item goes at the end

Other braces, such as {} in find -exec or {print $1} in awk, are left as they are. Placeholders work on local folders only.

Other flags

strata [DIR...]           one panel per directory
  -c, --config <FILE>     use another config file
  -t, --theme <THEME>     override the theme
      --no-plugins        start without plugins
      --list-themes       print every theme
      --dump-config       print a documented config
      --shell-init <SH>   print the shell function (bash, zsh, fish, powershell)
      --chooser-file <F>  pick files for another program (see below)
  -l, --layout <NAME>     open the tabs and panels saved with :layout save
  -e, --command <CMD>     run a `:` command once the panels are up (repeatable)
      --remote <CMD>      send a `:` command to a running strata (repeatable)
      --remote-query      print a running strata's directory and marked items
      --instance <PID>    the strata --remote talks to
      --list-instances    print each running strata's pid and directory

Picking files from other programs

strata --chooser-file <file> turns strata into a file picker: enter on a file (or on anything, once items are marked with space) writes the chosen paths to <file>, one per line, and quits. Quitting without choosing leaves the file untouched. Editors such as Neovim can use this the way they use yazi or ranger:

strata --chooser-file /tmp/chosen && cat /tmp/chosen

Scripting a running strata

-e runs : commands as strata starts, in the order given:

strata -e 'select *.jpg' -e 'sort size rev' ~/Pictures

--remote sends the same commands to a strata that is already running, so editors, scripts and window-manager keys can drive it. It prints what the command reported and exits nonzero if it failed:

strata --remote 'cd ~/projects' --remote 'select *.rs'
strata --remote-query | jq -r '.marked[]'     # the marked items, one per line

--remote-query prints JSON with cwd, hovered, marked, local (false on remote locations), panel and pid.

Programs strata starts, such as a :! shell, get STRATA_INSTANCE set to its pid, so strata --remote run from them drives that strata. Elsewhere it drives the most recently started one; pick another with --instance <pid> (see --list-instances).

Each strata listens on a socket only you can open, in $XDG_RUNTIME_DIR/strata (else a private folder in the temp dir). Set remote_control = false under [general] to turn it off. The socket also takes one request per line from tools like socat: a command line, {"command": "..."} or {"query": "state"}, each answered with a line of JSON. Remote control needs Unix sockets, so it is not available on Windows yet; -e works everywhere.