xcwd1
X current working directory
Usage
xcwd
Overview
xcwd is a simple tool which prints the current working directory of the focused window. It's useful for launching applications directly into the same directory as the focused application—for instance, you might want to launch a new terminal in the same directory as your editor. You can make this happen by binding something like
urxvt -cd "$(xcwd)"
to a keyboard shortcut within your window manager and then invoking that shortcut during editor usage.
Exit status
xcwd exits with a nonzero status if it can't figure out the working directory associated with the currently focused window and $HOME is unset. Otherwise, xcwd returns zero.
Environment
If xcwd can't figure out the working directory associated with the currently focused window, it falls back on $HOME.
Releases
Unchanged in 4 releases since Debian 10 (Buster).