mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-06-23 15:30:45 -04:00
Restore CALIBRE_USE_DARK_PALETTE on windows
This commit is contained in:
parent
09f6568dd7
commit
ce171699dc
@ -49,7 +49,7 @@ Environment variables
|
|||||||
the system theme -- beware of crashes and hangs.
|
the system theme -- beware of crashes and hangs.
|
||||||
* ``CALIBRE_SHOW_DEPRECATION_WARNINGS`` - causes calibre to print deprecation warnings to stdout. Useful for calibre developers.
|
* ``CALIBRE_SHOW_DEPRECATION_WARNINGS`` - causes calibre to print deprecation warnings to stdout. Useful for calibre developers.
|
||||||
* ``CALIBRE_NO_DEFAULT_PROGRAMS`` - prevent calibre from automatically registering the filetypes it is capable of handling with Windows.
|
* ``CALIBRE_NO_DEFAULT_PROGRAMS`` - prevent calibre from automatically registering the filetypes it is capable of handling with Windows.
|
||||||
* ``CALIBRE_USE_DARK_PALETTE`` - set it to ``1`` to have calibre use dark colors and ``0`` for light colors. Works on **Linux only**.
|
* ``CALIBRE_USE_DARK_PALETTE`` - set it to ``1`` to have calibre use dark colors and ``0`` for light colors. Overrides the system-wide dark setting. When set, changes to the colors while calibre is running will not take effect. Works on **Linux and Windows only**.
|
||||||
* ``SYSFS_PATH`` - Use if sysfs is mounted somewhere other than /sys
|
* ``SYSFS_PATH`` - Use if sysfs is mounted somewhere other than /sys
|
||||||
* ``http_proxy``, ``https_proxy`` - used on Linux to specify an HTTP(S) proxy
|
* ``http_proxy``, ``https_proxy`` - used on Linux to specify an HTTP(S) proxy
|
||||||
|
|
||||||
|
@ -1229,6 +1229,9 @@ class Application(QApplication):
|
|||||||
using_calibre_style = True
|
using_calibre_style = True
|
||||||
if using_calibre_style:
|
if using_calibre_style:
|
||||||
if iswindows:
|
if iswindows:
|
||||||
|
if 'CALIBRE_USE_DARK_PALETTE' in os.environ:
|
||||||
|
use_dark_palette = os.environ.get('CALIBRE_USE_DARK_PALETTE') == '1'
|
||||||
|
else:
|
||||||
use_dark_palette = windows_is_system_dark_mode_enabled()
|
use_dark_palette = windows_is_system_dark_mode_enabled()
|
||||||
elif ismacos:
|
elif ismacos:
|
||||||
use_dark_palette = False
|
use_dark_palette = False
|
||||||
@ -1257,6 +1260,8 @@ class Application(QApplication):
|
|||||||
@pyqtSlot(str, str, QDBusVariant)
|
@pyqtSlot(str, str, QDBusVariant)
|
||||||
def linux_desktop_setting_changed(self, namespace, key, val):
|
def linux_desktop_setting_changed(self, namespace, key, val):
|
||||||
if (namespace, key) == ('org.freedesktop.appearance', 'color-scheme'):
|
if (namespace, key) == ('org.freedesktop.appearance', 'color-scheme'):
|
||||||
|
if 'CALIBRE_USE_DARK_PALETTE' in os.environ:
|
||||||
|
return
|
||||||
use_dark_palette = val.variant() == 1
|
use_dark_palette = val.variant() == 1
|
||||||
if use_dark_palette != bool(self.is_dark_theme):
|
if use_dark_palette != bool(self.is_dark_theme):
|
||||||
if use_dark_palette:
|
if use_dark_palette:
|
||||||
@ -1266,6 +1271,8 @@ class Application(QApplication):
|
|||||||
self.on_palette_change()
|
self.on_palette_change()
|
||||||
|
|
||||||
def check_for_windows_palette_change(self):
|
def check_for_windows_palette_change(self):
|
||||||
|
if 'CALIBRE_USE_DARK_PALETTE' in os.environ:
|
||||||
|
return
|
||||||
use_dark_palette = bool(windows_is_system_dark_mode_enabled())
|
use_dark_palette = bool(windows_is_system_dark_mode_enabled())
|
||||||
if bool(self.is_dark_theme) != use_dark_palette:
|
if bool(self.is_dark_theme) != use_dark_palette:
|
||||||
if use_dark_palette:
|
if use_dark_palette:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user