diff --git a/doc/userscripts.asciidoc b/doc/userscripts.asciidoc index 04441f94b..7d1f3288b 100644 --- a/doc/userscripts.asciidoc +++ b/doc/userscripts.asciidoc @@ -33,6 +33,7 @@ The following environment variables will be set when a userscript is launched: - `QUTE_FIFO`: The FIFO or file to write commands to. - `QUTE_HTML`: Path of a file containing the HTML source of the current page. - `QUTE_TEXT`: Path of a file containing the plaintext of the current page. +- `QUTE_CONFIG_DIR`: Path of the directory containing qutebrowser's configuration. In `command` mode: diff --git a/qutebrowser/commands/userscripts.py b/qutebrowser/commands/userscripts.py index 530afb9f9..b5ce00e76 100644 --- a/qutebrowser/commands/userscripts.py +++ b/qutebrowser/commands/userscripts.py @@ -376,7 +376,9 @@ def run(cmd, *args, win_id, env, verbose=False): user_agent = config.get('network', 'user-agent') if user_agent is not None: env['QUTE_USER_AGENT'] = user_agent - env['QUTE_CONFIG_DIR'] = standarddir.config() + config_dir = standarddir.config() + if config_dir is not None: + env['QUTE_CONFIG_DIR'] = config_dir cmd_path = os.path.expanduser(cmd) # if cmd is not given as an absolute path, look it up