diff --git a/qutebrowser/browser/commands.py b/qutebrowser/browser/commands.py index 5c0e41e77..448741f9f 100644 --- a/qutebrowser/browser/commands.py +++ b/qutebrowser/browser/commands.py @@ -1252,9 +1252,11 @@ class CommandDispatcher: env = { 'QUTE_MODE': 'command', 'QUTE_SELECTED_TEXT': selection, - 'QUTE_COUNT': str(count), # must be a string } + if count is not None: + env['QUTE_COUNT'] = str(count) # must be str + idx = self._current_index() if idx != -1: env['QUTE_TITLE'] = self._tabbed_browser.widget.page_title(idx) diff --git a/tests/end2end/data/userscripts/hello_if_count b/tests/end2end/data/userscripts/hello_if_count index 7ba64a76e..efc8bdd6e 100755 --- a/tests/end2end/data/userscripts/hello_if_count +++ b/tests/end2end/data/userscripts/hello_if_count @@ -4,7 +4,7 @@ if [ "$QUTE_COUNT" = "5" ]; then echo "message-info 'Count is five!'" >> "$QUTE_FIFO" -elif [ "$QUTE_COUNT" = "None" ]; then +elif [ -z "$QUTE_COUNT" ]; then echo "message-info 'No count!'" >> "$QUTE_FIFO"