diff --git a/qutebrowser/browser/commands.py b/qutebrowser/browser/commands.py index 6c42dcd6e..3bd5569ee 100644 --- a/qutebrowser/browser/commands.py +++ b/qutebrowser/browser/commands.py @@ -507,7 +507,7 @@ class CommandDispatcher: idx = new_tabbed_browser.indexOf(newtab) new_tabbed_browser.set_page_title(idx, cur_title) - if config.val.tabs.show_favicons: + if config.val.tabs.favicons.show: new_tabbed_browser.setTabIcon(idx, curtab.icon()) if config.val.tabs.tabs_are_windows: new_tabbed_browser.window().setWindowIcon(curtab.icon()) diff --git a/qutebrowser/browser/hints.py b/qutebrowser/browser/hints.py index 625f9097f..10686c0fd 100644 --- a/qutebrowser/browser/hints.py +++ b/qutebrowser/browser/hints.py @@ -203,7 +203,7 @@ class HintActions: Target.window: usertypes.ClickTarget.window, Target.hover: usertypes.ClickTarget.normal, } - if config.val.tabs.background_tabs: + if config.val.tabs.background: target_mapping[Target.tab] = usertypes.ClickTarget.tab_bg else: target_mapping[Target.tab] = usertypes.ClickTarget.tab @@ -684,8 +684,7 @@ class HintManager(QObject): Target.hover, Target.userscript, Target.spawn, Target.download, Target.normal, Target.current]: pass - elif (target == Target.tab and - config.val.tabs.background_tabs): + elif target == Target.tab and config.val.tabs.background: pass else: name = target.name.replace('_', '-') diff --git a/qutebrowser/browser/webelem.py b/qutebrowser/browser/webelem.py index 401a3bb93..66d86e273 100644 --- a/qutebrowser/browser/webelem.py +++ b/qutebrowser/browser/webelem.py @@ -329,7 +329,7 @@ class AbstractWebElement(collections.abc.MutableMapping): usertypes.ClickTarget.tab: Qt.ControlModifier, usertypes.ClickTarget.tab_bg: Qt.ControlModifier, } - if config.val.tabs.background_tabs: + if config.val.tabs.background: modifiers[usertypes.ClickTarget.tab] |= Qt.ShiftModifier else: modifiers[usertypes.ClickTarget.tab_bg] |= Qt.ShiftModifier diff --git a/qutebrowser/browser/webengine/webview.py b/qutebrowser/browser/webengine/webview.py index f8cefc300..f7221426c 100644 --- a/qutebrowser/browser/webengine/webview.py +++ b/qutebrowser/browser/webengine/webview.py @@ -80,10 +80,10 @@ class WebEngineView(QWebEngineView): The new QWebEngineView object. """ debug_type = debug.qenum_key(QWebEnginePage, wintype) - background_tabs = config.val.tabs.background_tabs + background = config.val.tabs.background - log.webview.debug("createWindow with type {}, background_tabs " - "{}".format(debug_type, background_tabs)) + log.webview.debug("createWindow with type {}, background {}".format( + debug_type, background)) if wintype == QWebEnginePage.WebBrowserWindow: # Shift-Alt-Click @@ -95,13 +95,13 @@ class WebEngineView(QWebEngineView): elif wintype == QWebEnginePage.WebBrowserTab: # Middle-click / Ctrl-Click with Shift # FIXME:qtwebengine this also affects target=_blank links... - if background_tabs: + if background: target = usertypes.ClickTarget.tab else: target = usertypes.ClickTarget.tab_bg elif wintype == QWebEnginePage.WebBrowserBackgroundTab: # Middle-click / Ctrl-Click - if background_tabs: + if background: target = usertypes.ClickTarget.tab_bg else: target = usertypes.ClickTarget.tab diff --git a/qutebrowser/browser/webkit/webview.py b/qutebrowser/browser/webkit/webview.py index cbdfb1854..682f8b55f 100644 --- a/qutebrowser/browser/webkit/webview.py +++ b/qutebrowser/browser/webkit/webview.py @@ -285,10 +285,10 @@ class WebView(QWebView): This is implemented here as we don't need it for QtWebEngine. """ if e.button() == Qt.MidButton or e.modifiers() & Qt.ControlModifier: - background_tabs = config.val.tabs.background_tabs + background = config.val.tabs.background if e.modifiers() & Qt.ShiftModifier: - background_tabs = not background_tabs - if background_tabs: + background = not background + if background: target = usertypes.ClickTarget.tab_bg else: target = usertypes.ClickTarget.tab diff --git a/qutebrowser/mainwindow/tabbedbrowser.py b/qutebrowser/mainwindow/tabbedbrowser.py index 515ec547d..81025570c 100644 --- a/qutebrowser/mainwindow/tabbedbrowser.py +++ b/qutebrowser/mainwindow/tabbedbrowser.py @@ -430,7 +430,7 @@ class TabbedBrowser(tabwidget.TabWidget): tab.openurl(url) if background is None: - background = config.val.tabs.background_tabs + background = config.val.tabs.background if background: # Make sure the background tab has the correct initial size. # With a foreground tab, it's going to be resized correctly by the @@ -516,7 +516,7 @@ class TabbedBrowser(tabwidget.TabWidget): else: self.setTabIcon(idx, QIcon()) if (config.val.tabs.tabs_are_windows and - config.val.tabs.show_favicons): + config.val.tabs.favicons.show): self.window().setWindowIcon(self.default_window_icon) if idx == self.currentIndex(): self.update_window_title() @@ -580,7 +580,7 @@ class TabbedBrowser(tabwidget.TabWidget): tab: The WebView where the title was changed. icon: The new icon """ - if not config.val.tabs.show_favicons: + if not config.val.tabs.favicons.show: return try: idx = self._tab_index(tab) diff --git a/qutebrowser/mainwindow/tabwidget.py b/qutebrowser/mainwindow/tabwidget.py index f3a72bb10..f5301e18a 100644 --- a/qutebrowser/mainwindow/tabwidget.py +++ b/qutebrowser/mainwindow/tabwidget.py @@ -562,23 +562,13 @@ class TabBar(QTabBar): tab = QStyleOptionTab() self.initStyleOption(tab, idx) - bg_parts = ['tabs', 'bg'] - fg_parts = ['tabs', 'fg'] + setting = config.val.colors.tabs if idx == selected: - bg_parts.append('selected') - fg_parts.append('selected') + setting = setting.selected + setting = setting.odd if idx % 2 else setting.even - if idx % 2: - bg_parts.append('odd') - fg_parts.append('odd') - else: - bg_parts.append('even') - fg_parts.append('even') - - bg_color = config.get('colors', '.'.join(bg_parts)) - fg_color = config.get('colors', '.'.join(fg_parts)) - tab.palette.setColor(QPalette.Window, bg_color) - tab.palette.setColor(QPalette.WindowText, fg_color) + tab.palette.setColor(QPalette.Window, setting.bg) + tab.palette.setColor(QPalette.WindowText, setting.fg) indicator_color = self.tab_indicator_color(idx) tab.palette.setColor(QPalette.Base, indicator_color) @@ -841,7 +831,7 @@ class TabBarStyle(QCommonStyle): position = config.val.tabs.position if (opt.icon.isNull() and position in [QTabWidget.East, QTabWidget.West] and - config.val.tabs.show_favicons): + config.val.tabs.favicons.show): tab_icon_size = icon_size else: actual_size = opt.icon.actualSize(icon_size, icon_mode, icon_state)