From 842c2d297e4aaa547113de213ab41e838b6cfdb1 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Sun, 16 Apr 2017 13:07:33 +0200 Subject: [PATCH] Allow to set message clear timer to 0 Fixes #2527 --- CHANGELOG.asciidoc | 1 + doc/help/settings.asciidoc | 1 + qutebrowser/config/configdata.py | 5 +++-- qutebrowser/mainwindow/messageview.py | 7 +++++-- 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc index 9b7b809c9..983f8a6d3 100644 --- a/CHANGELOG.asciidoc +++ b/CHANGELOG.asciidoc @@ -44,6 +44,7 @@ Changed - The HTTP cache is disabled with QtWebKit on Qt 5.8 now as it leads to frequent crashes due to a Qt bug. - stdin is now closed immediately for processes spawned from qutebrowser +- When ui -> message-timeout is set to 0, messages are now never cleared. Fixed ~~~~~ diff --git a/doc/help/settings.asciidoc b/doc/help/settings.asciidoc index a2df65ca4..9092ea052 100644 --- a/doc/help/settings.asciidoc +++ b/doc/help/settings.asciidoc @@ -581,6 +581,7 @@ Default: +pass:[bottom]+ [[ui-message-timeout]] === message-timeout Time (in ms) to show messages in the statusbar for. +Set to 0 to never clear messages. Default: +pass:[2000]+ diff --git a/qutebrowser/config/configdata.py b/qutebrowser/config/configdata.py index 2c5b27808..abf704801 100644 --- a/qutebrowser/config/configdata.py +++ b/qutebrowser/config/configdata.py @@ -317,8 +317,9 @@ def data(readonly=False): "The position of the status bar."), ('message-timeout', - SettingValue(typ.Int(), '2000'), - "Time (in ms) to show messages in the statusbar for."), + SettingValue(typ.Int(minval=0), '2000'), + "Time (in ms) to show messages in the statusbar for.\n" + "Set to 0 to never clear messages."), ('message-unfocused', SettingValue(typ.Bool(), 'false'), diff --git a/qutebrowser/mainwindow/messageview.py b/qutebrowser/mainwindow/messageview.py index 5c407b78b..7b2d64e07 100644 --- a/qutebrowser/mainwindow/messageview.py +++ b/qutebrowser/mainwindow/messageview.py @@ -98,7 +98,9 @@ class MessageView(QWidget): @config.change_filter('ui', 'message-timeout') def _set_clear_timer_interval(self): """Configure self._clear_timer according to the config.""" - self._clear_timer.setInterval(config.get('ui', 'message-timeout')) + interval = config.get('ui', 'message-timeout') + if interval != 0: + self._clear_timer.setInterval(interval) @pyqtSlot() def clear_messages(self): @@ -125,7 +127,8 @@ class MessageView(QWidget): widget = Message(level, text, replace=replace, parent=self) self._vbox.addWidget(widget) widget.show() - self._clear_timer.start() + if config.get('ui', 'message-timeout') != 0: + self._clear_timer.start() self._messages.append(widget) self._last_text = text self.show()