Skip to content
Arijit Basu edited this page Jun 7, 2021 · 21 revisions

Exec executing a command, pipes provide a way to interact with the xplr sessions from different programs. This, along with the environment variables allows xplr to integrate with other tools.

Each xplr session will create its own set of input and output pipes.

As of now, these are the available pipes

Pipe Purpose
$XPLR_PIPE_MSG_IN read messages from other programs.
$XPLR_PIPE_SELECTION_OUT write the new-line delimited selected paths for other programs to read.
$XPLR_PIPE_GLOBAL_HELP_MENU_OUT write the global help menu for anyone to read.
$XPLR_PIPE_LOGS_OUT write the logs for anyone to read.
$XPLR_PIPE_RESULT_OUT write the currect result (selection or focused path).
$XPLR_PIPE_DIRECTORY_NODES_OUT write the absolute path of filtered nodes in present working directory.
$XPLR_PIPE_HISTORY_OUT the dynamic history of last visited directories.

We can pass messages to a running xplr session if we know its runtime path, which is made unique by the session's $XPLR_PID. Generally the input pipe is a file named msg_in inside $XPLR_SESSION_PATH/pipe/, also exported as $XPLR_PIPE_MSG_IN.

Example message passing:

echo ChangeDirectory: /tmp >> "${XPLR_PIPE_MSG_IN:?}"
echo FocusNext >> "${XPLR_PIPE_MSG_IN:?}"

Note: Pipes are not available when calling Lua functions, because Lua can receive input from the given argument and return the output messages, enabling better interaction than what the pipes allow.

Back to: Features

Clone this wiki locally