diff --git a/doc/help/settings.asciidoc b/doc/help/settings.asciidoc index 4dce9bd18..5a898a9ce 100644 --- a/doc/help/settings.asciidoc +++ b/doc/help/settings.asciidoc @@ -83,6 +83,7 @@ |<>|Enables or disables the Spatial Navigation feature |<>|Whether hyperlinks should be included in the keyboard focus chain. |<>|Whether to enable Opera-like mouse rocker gestures. This disables the context menu. +|<>|How much to divide the mouse wheel movements to translate them into zoom increments. |============== .Quick reference for section ``tabs'' @@ -785,6 +786,12 @@ Valid values: Default: +pass:[false]+ +[[input-mouse-zoom-divider]] +=== mouse-zoom-divider +How much to divide the mouse wheel movements to translate them into zoom increments. + +Default: +pass:[512]+ + == tabs Configuration of the tab bar. diff --git a/qutebrowser/browser/webview.py b/qutebrowser/browser/webview.py index d64c73947..39985953e 100644 --- a/qutebrowser/browser/webview.py +++ b/qutebrowser/browser/webview.py @@ -527,3 +527,23 @@ class WebView(QWebView): menu = self.page().createStandardContextMenu() self.shutting_down.connect(menu.close) menu.exec_(e.globalPos()) + + def wheelEvent(self, e): + """Zoom on Ctrl-Mousewheel. + + Args: + e: The QWheelEvent. + """ + if e.modifiers() & Qt.ControlModifier: + e.accept() + divider = config.get('input', 'mouse-zoom-divider') + factor = self.zoomFactor() + e.angleDelta().y() / divider + if factor < 0: + return + perc = int(100 * factor) + message.info(self.win_id, "Zoom level: {}%".format(perc)) + self._zoom.fuzzyval = perc + self.setZoomFactor(factor) + self._default_zoom_changed = True + else: + super().wheelEvent(e) diff --git a/qutebrowser/config/configdata.py b/qutebrowser/config/configdata.py index c4937bcb9..b43425b39 100644 --- a/qutebrowser/config/configdata.py +++ b/qutebrowser/config/configdata.py @@ -392,6 +392,11 @@ DATA = collections.OrderedDict([ SettingValue(typ.Bool(), 'false'), "Whether to enable Opera-like mouse rocker gestures. This disables " "the context menu."), + + ('mouse-zoom-divider', + SettingValue(typ.Int(minval=1), '512'), + "How much to divide the mouse wheel movements to translate them " + "into zoom increments."), )), ('tabs', sect.KeyValue(