diff --git a/doc/userscripts.asciidoc b/doc/userscripts.asciidoc index 433c71ff0..8904d0ef3 100644 --- a/doc/userscripts.asciidoc +++ b/doc/userscripts.asciidoc @@ -38,6 +38,7 @@ The following environment variables will be set when a userscript is launched: - `QUTE_CONFIG_DIR`: Path of the directory containing qutebrowser's configuration. - `QUTE_DATA_DIR`: Path of the directory containing qutebrowser's data. - `QUTE_DOWNLOAD_DIR`: Path of the downloads directory. +- `QUTE_COMMANDLINE_TEXT`: Text currently in qutebrowser's command line. (Depends on which window the userscript is launched in) In `command` mode: diff --git a/qutebrowser/commands/userscripts.py b/qutebrowser/commands/userscripts.py index 960e97318..4533e86b1 100644 --- a/qutebrowser/commands/userscripts.py +++ b/qutebrowser/commands/userscripts.py @@ -419,6 +419,8 @@ def run_async(tab, cmd, *args, win_id, env, verbose=False): env['QUTE_CONFIG_DIR'] = standarddir.config() env['QUTE_DATA_DIR'] = standarddir.data() env['QUTE_DOWNLOAD_DIR'] = downloads.download_dir() + env['QUTE_COMMANDLINE_TEXT'] = objreg.get('status-command', scope='window', + window=win_id).text() cmd_path = os.path.expanduser(cmd)