diff --git a/qutebrowser/mainwindow/tabbedbrowser.py b/qutebrowser/mainwindow/tabbedbrowser.py index 842891df6..e34670258 100644 --- a/qutebrowser/mainwindow/tabbedbrowser.py +++ b/qutebrowser/mainwindow/tabbedbrowser.py @@ -23,7 +23,7 @@ import functools import collections from PyQt5.QtWidgets import QSizePolicy -from PyQt5.QtCore import pyqtSignal, pyqtSlot, QSize, QTimer, QUrl +from PyQt5.QtCore import pyqtSignal, pyqtSlot, QTimer, QUrl from PyQt5.QtGui import QIcon from qutebrowser.config import config @@ -108,9 +108,6 @@ class TabbedBrowser(tabwidget.TabWidget): self._undo_stack = [] self._filter = signalfilter.SignalFilter(win_id, self) self._now_focused = None - # FIXME adjust this to font size - # https://github.com/The-Compiler/qutebrowser/issues/119 - self.setIconSize(QSize(12, 12)) objreg.get('config').changed.connect(self.update_favicons) objreg.get('config').changed.connect(self.update_window_title) objreg.get('config').changed.connect(self.update_tab_titles) diff --git a/qutebrowser/mainwindow/tabwidget.py b/qutebrowser/mainwindow/tabwidget.py index de6ee9961..0728de95a 100644 --- a/qutebrowser/mainwindow/tabwidget.py +++ b/qutebrowser/mainwindow/tabwidget.py @@ -21,6 +21,7 @@ import collections import functools +import math from PyQt5.QtCore import pyqtSignal, pyqtSlot, Qt, QSize, QRect, QPoint, QTimer from PyQt5.QtWidgets import (QTabWidget, QTabBar, QSizePolicy, QCommonStyle, @@ -293,6 +294,13 @@ class TabBar(QTabBar): """Set the tab bar font.""" self.setFont(config.get('fonts', 'tabbar')) + def resizeEvent(self, _s): + """Set the favicon size to the tabbar size minus some padding.""" + height = self.size().height() + if height > 0: + height = math.ceil(height - height / 7) + self.setIconSize(QSize(height, height)) + @config.change_filter('colors', 'tabs.bg.bar') def set_colors(self): """Set the tab bar colors."""