mirror of
https://github.com/Misterio77/Foundry.git
synced 2026-08-24 10:04:09 -05:00
feat(home/qutebrowser): force repaint when color changed
This commit is contained in:
@@ -43,10 +43,8 @@ in {
|
||||
};
|
||||
|
||||
qutebrowser = prev.qutebrowser.overrideAttrs (oldAttrs: {
|
||||
# Using 'wayland' platform seems to force qt to read color scheme prefers from xdp instead of reading from the color theme name
|
||||
# The former seems to not get live-reloaded for now
|
||||
# Might get fixed by https://codereview.qt-project.org/c/qt/qtbase/+/547252
|
||||
# In the meantime, force qutebrowser to use xorg so that we get live reloads
|
||||
# Force x11, as live-refreshing colorscheme based on portal is not working on wayland platform atm
|
||||
# This is fixed by https://codereview.qt-project.org/c/qt/qtbase/+/547252
|
||||
preFixup =
|
||||
oldAttrs.preFixup
|
||||
+ ''
|
||||
@@ -57,6 +55,8 @@ in {
|
||||
patches =
|
||||
(oldAttrs.patches or [])
|
||||
++ [
|
||||
# Repaint tabs when colorscheme changes
|
||||
./qutebrowser-refresh-tab-colorscheme.patch
|
||||
# Reload on SIGHUP
|
||||
# https://github.com/qutebrowser/qutebrowser/pull/8110
|
||||
(final.fetchurl {
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
diff --git a/qutebrowser/app.py b/qutebrowser/app.py
|
||||
index 51603a2b9..21c412dd1 100644
|
||||
--- a/qutebrowser/app.py
|
||||
+++ b/qutebrowser/app.py
|
||||
@@ -553,6 +553,7 @@ class Application(QApplication):
|
||||
|
||||
self.launch_time = datetime.datetime.now()
|
||||
self.focusObjectChanged.connect(self.on_focus_object_changed)
|
||||
+ self.styleHints().colorSchemeChanged.connect(self._on_colorscheme_changed)
|
||||
|
||||
if machinery.IS_QT5:
|
||||
# default and removed in Qt 6
|
||||
@@ -560,6 +561,14 @@ class Application(QApplication):
|
||||
|
||||
self.new_window.connect(self._on_new_window)
|
||||
|
||||
+ def _on_colorscheme_changed(self, *args):
|
||||
+ # Repaint all tabs when styleHints is updated
|
||||
+ log.init.debug(f"Colorscheme changed to {args[0]}, refreshing tabs")
|
||||
+ for window in objreg.window_registry.values():
|
||||
+ for tab in window.tabbed_browser.widgets():
|
||||
+ tab.refresh()
|
||||
+
|
||||
+
|
||||
@pyqtSlot(mainwindow.MainWindow)
|
||||
def _on_new_window(self, window):
|
||||
window.tabbed_browser.shutting_down.connect(functools.partial(
|
||||
diff --git a/qutebrowser/browser/webengine/webenginetab.py b/qutebrowser/browser/webengine/webenginetab.py
|
||||
index 02d912a50..402fa7b4f 100644
|
||||
--- a/qutebrowser/browser/webengine/webenginetab.py
|
||||
+++ b/qutebrowser/browser/webengine/webenginetab.py
|
||||
@@ -1660,6 +1660,13 @@ class WebEngineTab(browsertab.AbstractTab):
|
||||
else:
|
||||
selection.selectNone()
|
||||
|
||||
+ def refresh(self):
|
||||
+ """Properly repaint the tab content."""
|
||||
+ settings = self.settings._settings
|
||||
+ show_scroll_bars = settings.WebAttribute.ShowScrollBars
|
||||
+ # Dirty hack
|
||||
+ settings.setAttribute(show_scroll_bars, settings.testAttribute(show_scroll_bars))
|
||||
+
|
||||
def _connect_signals(self):
|
||||
view = self._widget
|
||||
page = view.page()
|
||||
Reference in New Issue
Block a user