summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/userscripts.asciidoc1
-rw-r--r--qutebrowser/browser/commands.py3
2 files changed, 4 insertions, 0 deletions
diff --git a/doc/userscripts.asciidoc b/doc/userscripts.asciidoc
index 5ff358ee0..4539a0ca8 100644
--- a/doc/userscripts.asciidoc
+++ b/doc/userscripts.asciidoc
@@ -56,6 +56,7 @@ In `command` mode:
- `QUTE_TITLE`: The title of the current page.
- `QUTE_SELECTED_TEXT`: The text currently selected on the page.
- `QUTE_COUNT`: The `count` from the spawn command running the userscript.
+- `QUTE_TAB_INDEX`: The current tab's index.
In `hints` mode:
diff --git a/qutebrowser/browser/commands.py b/qutebrowser/browser/commands.py
index 395d8e8a4..11f46b3b7 100644
--- a/qutebrowser/browser/commands.py
+++ b/qutebrowser/browser/commands.py
@@ -1152,6 +1152,9 @@ class CommandDispatcher:
idx = self._current_index()
if idx != -1:
+ env['QUTE_TAB_INDEX'] = str(idx + 1)
+
+ if idx != -1:
env['QUTE_TITLE'] = self._tabbed_browser.widget.page_title(idx)
# FIXME:qtwebengine: If tab is None, run_async will fail!