From 19c27a04e5e8563f0b4d694c451bb7a5d70dec36 Mon Sep 17 00:00:00 2001 From: Nathan Isom Date: Thu, 15 Oct 2015 13:18:32 -0500 Subject: [PATCH] Add completion scrollbar settings. --- qutebrowser/completion/completionwidget.py | 24 +++++++++++++++++++--- qutebrowser/config/configdata.py | 16 +++++++++++++++ 2 files changed, 37 insertions(+), 3 deletions(-) diff --git a/qutebrowser/completion/completionwidget.py b/qutebrowser/completion/completionwidget.py index 9281a053a..b1c8ec902 100644 --- a/qutebrowser/completion/completionwidget.py +++ b/qutebrowser/completion/completionwidget.py @@ -81,10 +81,28 @@ class CompletionView(QTreeView): QTreeView:item::hover { border: 0px; } - """ - # FIXME style scrollbar - # https://github.com/The-Compiler/qutebrowser/issues/117 + QTreeView QScrollBar { + width: 12px; + {{ color['completion.scrollbar.bg'] }}; + } + + QTreeView QScrollBar::handle{ + /** + This is done this way to evade 'magic' + ref: http://git.io/vCMqZ + Will need to be changed when we utilize jinja better. + **/ + background: {{ config.get('colors', 'completion.scrollbar.fg') }}; + border: 2px solid + {{ config.get('colors', 'completion.scrollbar.bg') }}; + } + + QTreeView QScrollBar::sub-line, QScrollBar::add-line { + border: none; + background:none; + } + """ resize_completion = pyqtSignal() diff --git a/qutebrowser/config/configdata.py b/qutebrowser/config/configdata.py index 1517280a8..627357478 100644 --- a/qutebrowser/config/configdata.py +++ b/qutebrowser/config/configdata.py @@ -414,6 +414,14 @@ def data(readonly=False): "Whether to shrink the completion to be smaller than the " "configured size if there are no scrollbars."), + ('scrollbar.width', + SettingValue(typ.Int(minval=0), '12'), + "Width of the scrollbar in the completion window (in px)."), + + ('scrollbar.padding', + SettingValue(typ.Int(minval=0), '2'), + "Padding of scrollbar handle in completion window (in px)."), + readonly=readonly )), @@ -872,6 +880,14 @@ def data(readonly=False): SettingValue(typ.QssColor(), '#ff4444'), "Foreground color of the matched text in the completion."), + ('completion.scrollbar.fg', + SettingValue(typ.QssColor(), '${completion.fg}'), + "Color of the scrollbar handle in completion view."), + + ('completion.scrollbar.bg', + SettingValue(typ.QssColor(), '${completion.bg}'), + "Color of the scrollbar in completion view"), + ('statusbar.fg', SettingValue(typ.QssColor(), 'white'), "Foreground color of the statusbar."),