diff --git a/qutebrowser/config/configdata.py b/qutebrowser/config/configdata.py index e4c624e47..42d6d4c13 100644 --- a/qutebrowser/config/configdata.py +++ b/qutebrowser/config/configdata.py @@ -431,6 +431,10 @@ DATA = OrderedDict([ SettingValue(types.Bool(), 'true'), "Whether to show favicons in the tab bar."), + ('expand', + SettingValue(types.Bool(), 'false'), + "Whether to expand tabs to use the full window width."), + )), ('storage', sect.KeyValue( diff --git a/qutebrowser/widgets/tabwidget.py b/qutebrowser/widgets/tabwidget.py index 5574fe409..9669f15c0 100644 --- a/qutebrowser/widgets/tabwidget.py +++ b/qutebrowser/widgets/tabwidget.py @@ -17,7 +17,7 @@ """The tab widget used for TabbedBrowser from browser.py.""" -from PyQt5.QtCore import pyqtSlot, Qt +from PyQt5.QtCore import pyqtSlot, Qt, QSize from PyQt5.QtWidgets import QTabWidget, QTabBar, QSizePolicy from PyQt5.QtGui import QIcon, QPixmap @@ -131,3 +131,14 @@ class TabBar(QTabBar): if idx == -1: return super().mousePressEvent(e) self.tabCloseRequested.emit(idx) + + def tabSizeHint(self, index): + """Override tabSizeHint so all tabs are the same size. + + https://wiki.python.org/moin/PyQt/Customising%20tab%20bars + """ + if config.get('tabbar', 'expand'): + height = super().tabSizeHint(index).height() + return QSize(self.width() / self.count(), height) + else: + return super().tabSizeHint(index)