diff options
author | Will Ruggiano <wmruggiano@gmail.com> | 2022-02-10 10:35:06 -0700 |
---|---|---|
committer | Will Ruggiano <wmruggiano@gmail.com> | 2022-02-10 13:44:17 -0700 |
commit | f5b6b426e24426b58154cf187255fef80ab27007 (patch) | |
tree | d4c9764df5efda5cb1adb30edf9dee6d9a150f30 | |
parent | 02e23ef1240f3f4093b94bf3d67d1057085c28b1 (diff) | |
download | qutebrowser-f5b6b426e24426b58154cf187255fef80ab27007.tar.gz qutebrowser-f5b6b426e24426b58154cf187255fef80ab27007.zip |
feat: pass QUTE_TAB_INDEX to userscripts
-rw-r--r-- | doc/userscripts.asciidoc | 1 | ||||
-rw-r--r-- | qutebrowser/browser/commands.py | 3 |
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! |