summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Bruhin <me@the-compiler.org>2022-03-31 13:14:12 +0200
committerFlorian Bruhin <me@the-compiler.org>2022-03-31 13:14:12 +0200
commit3ec04380b0e9ab55cc3e4ebef028e3f699b0e743 (patch)
treed23f66af8c78831af05ef2c034b6b82c45f26dbe
parent4d65a8a3889d0170fc1ea95cf0c43f410dd4cc16 (diff)
parentf5b6b426e24426b58154cf187255fef80ab27007 (diff)
downloadqutebrowser-3ec04380b0e9ab55cc3e4ebef028e3f699b0e743.tar.gz
qutebrowser-3ec04380b0e9ab55cc3e4ebef028e3f699b0e743.zip
Merge remote-tracking branch 'origin/pr/7014'
-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!