From a73fee80453ef485f8df35000de06d6732ba9af6 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Sun, 4 Jun 2023 00:57:36 +0200 Subject: Add settings to customize tooltips See #7706 --- doc/changelog.asciidoc | 1 + doc/help/settings.asciidoc | 30 ++++++++++++++++++++++++++++++ qutebrowser/config/configdata.yml | 30 ++++++++++++++++++++++++++++++ qutebrowser/mainwindow/mainwindow.py | 12 ++++++++++++ 4 files changed, 73 insertions(+) diff --git a/doc/changelog.asciidoc b/doc/changelog.asciidoc index 2c1763afc..50d157d40 100644 --- a/doc/changelog.asciidoc +++ b/doc/changelog.asciidoc @@ -51,6 +51,7 @@ Added * `qute-keepassxc` now supports unlock-on-demand, multiple account selection via rofi, and inserting TOTP-codes (experimental). - New `colors.webpage.darkmode.increase_text_contrast` setting for Qt 6.3+ +- New `fonts.tooltip`, `colors.tooltip.bg` and `colors.tooltip.fg` settings. Removed ~~~~~~~ diff --git a/doc/help/settings.asciidoc b/doc/help/settings.asciidoc index 0e58fda8c..34262b945 100644 --- a/doc/help/settings.asciidoc +++ b/doc/help/settings.asciidoc @@ -112,6 +112,8 @@ |<>|Foreground color of selected even tabs. |<>|Background color of selected odd tabs. |<>|Foreground color of selected odd tabs. +|<>|Background color of tooltips. +|<>|Foreground color of tooltips. |<>|Background color for webpages if unset (or empty to use the theme's color). |<>|Which algorithm to use for modifying how colors are rendered with darkmode. |<>|Contrast for dark mode. @@ -237,6 +239,7 @@ |<>|Font used in the statusbar. |<>|Font used for selected tabs. |<>|Font used for unselected tabs. +|<>|Font used for tooltips. |<>|Font family for cursive fonts. |<>|Font family for fantasy fonts. |<>|Font family for fixed fonts. @@ -1614,6 +1617,24 @@ Type: <> Default: +pass:[white]+ +[[colors.tooltip.bg]] +=== colors.tooltip.bg +Background color of tooltips. +If set to null, the Qt default is used. + +Type: <> + +Default: empty + +[[colors.tooltip.fg]] +=== colors.tooltip.fg +Foreground color of tooltips. +If set to null, the Qt default is used. + +Type: <> + +Default: empty + [[colors.webpage.bg]] === colors.webpage.bg Background color for webpages if unset (or empty to use the theme's color). @@ -3186,6 +3207,15 @@ Type: <> Default: +pass:[default_size default_family]+ +[[fonts.tooltip]] +=== fonts.tooltip +Font used for tooltips. +If set to null, the Qt default is used. + +Type: <> + +Default: empty + [[fonts.web.family.cursive]] === fonts.web.family.cursive Font family for cursive fonts. diff --git a/qutebrowser/config/configdata.yml b/qutebrowser/config/configdata.yml index e8975373a..bedcc2ade 100644 --- a/qutebrowser/config/configdata.yml +++ b/qutebrowser/config/configdata.yml @@ -2726,6 +2726,26 @@ colors.contextmenu.bg: colors.contextmenu.fg: renamed: colors.contextmenu.menu.fg +colors.tooltip.bg: + type: + name: QssColor + none_ok: true + default: null + desc: >- + Background color of tooltips. + + If set to null, the Qt default is used. + +colors.tooltip.fg: + type: + name: QssColor + none_ok: true + default: null + desc: >- + Foreground color of tooltips. + + If set to null, the Qt default is used. + colors.contextmenu.menu.bg: type: name: QssColor @@ -3392,6 +3412,16 @@ fonts.completion.category: type: Font desc: Font used in the completion categories. +fonts.tooltip: + type: + name: Font + none_ok: true + default: null + desc: >- + Font used for tooltips. + + If set to null, the Qt default is used. + fonts.contextmenu: type: name: Font diff --git a/qutebrowser/mainwindow/mainwindow.py b/qutebrowser/mainwindow/mainwindow.py index 4b01dadfd..dccf9cea7 100644 --- a/qutebrowser/mainwindow/mainwindow.py +++ b/qutebrowser/mainwindow/mainwindow.py @@ -152,6 +152,18 @@ class MainWindow(QWidget): padding-bottom: {{ conf.hints.padding['bottom'] }}px; } + QToolTip { + {% if conf.fonts.tooltip %} + font: {{ conf.fonts.tooltip }}; + {% endif %} + {% if conf.colors.tooltip.bg %} + background-color: {{ conf.colors.tooltip.bg }}; + {% endif %} + {% if conf.colors.tooltip.fg %} + color: {{ conf.colors.tooltip.fg }}; + {% endif %} + } + QMenu { {% if conf.fonts.contextmenu %} font: {{ conf.fonts.contextmenu }}; -- cgit v1.2.3-54-g00ecf