From 8ad28719abd8f358afefc8b5240762ae2ee3be65 Mon Sep 17 00:00:00 2001 From: pkill9 Date: Mon, 30 Jan 2017 11:48:10 +0000 Subject: [PATCH 1/2] Add "QUTE_COMMANDLINE_TEXT" environment variable for userscripts. - Added "QUTE_COMMANDLINE_TEXT" environment variable for userscripts. - Updated documentation to include "QUTE_COMMANDLINE_TEXT" environment variable for userscripts. --- doc/userscripts.asciidoc | 1 + qutebrowser/commands/userscripts.py | 2 ++ 2 files changed, 3 insertions(+) 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) From 22873f829c112d3956ead5112a19d84fcfd856ed Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Sat, 4 Feb 2017 17:43:27 +0100 Subject: [PATCH 2/2] Update docs --- CHANGELOG.asciidoc | 5 +++++ README.asciidoc | 1 + doc/userscripts.asciidoc | 2 +- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc index 0fb8bda11..ff303c637 100644 --- a/CHANGELOG.asciidoc +++ b/CHANGELOG.asciidoc @@ -17,6 +17,11 @@ This project adheres to http://semver.org/[Semantic Versioning]. v0.10.0 (unreleased) -------------------- +Added +----- + +- Userscripts now have a new `$QUTE_COMMANDLINE_TEXT` environment variable, containing the current commandline contents. + Changed ~~~~~~~ diff --git a/README.asciidoc b/README.asciidoc index bdc4065c0..bbd6277a5 100644 --- a/README.asciidoc +++ b/README.asciidoc @@ -241,6 +241,7 @@ Contributors, sorted by the number of commits in descending order: * xd1le * rsteube * rmortens +* pkill9 * oniondreams * issue * haxwithaxe diff --git a/doc/userscripts.asciidoc b/doc/userscripts.asciidoc index 8904d0ef3..b44a6b8ff 100644 --- a/doc/userscripts.asciidoc +++ b/doc/userscripts.asciidoc @@ -38,7 +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) +- `QUTE_COMMANDLINE_TEXT`: Text currently in qutebrowser's command line. In `command` mode: