[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master 58f0603d40d: Allow users to opt out of following Windows Dark mod
From: |
Eli Zaretskii |
Subject: |
master 58f0603d40d: Allow users to opt out of following Windows Dark mode |
Date: |
Sat, 27 Jan 2024 12:12:18 -0500 (EST) |
branch: master
commit 58f0603d40d238383aaa911eb09b3e2809177bfa
Author: Eli Zaretskii <eliz@gnu.org>
Commit: Eli Zaretskii <eliz@gnu.org>
Allow users to opt out of following Windows Dark mode
* src/w32fns.c (globals_of_w32fns) <w32-follow-system-dark-mode>:
New variable.
(w32_applytheme): Disable application of Dark mode if
'w32-follow-system-dark-mode' is nil.
* etc/NEWS:
* doc/emacs/msdos.texi (Windows Misc): Document
'w32-follow-system-dark-mode'.
---
doc/emacs/msdos.texi | 23 +++++++++++++++++------
etc/NEWS | 10 ++++++++++
lisp/cus-start.el | 2 ++
src/w32fns.c | 10 +++++++++-
4 files changed, 38 insertions(+), 7 deletions(-)
diff --git a/doc/emacs/msdos.texi b/doc/emacs/msdos.texi
index b00f116ee4e..861c0d90dc6 100644
--- a/doc/emacs/msdos.texi
+++ b/doc/emacs/msdos.texi
@@ -1182,12 +1182,23 @@ click-to-focus policy.
@end ifnottex
On Windows 10 (version 1809 and higher) and Windows 11, Emacs title
-bars and scroll bars will follow the system's Light or Dark mode,
-similar to other programs such as Explorer and Command Prompt. To
-change the color mode, select @code{Personalization} from
-@w{@code{Windows Settings}}, then
-@w{@code{Colors->Choose your color}} (or @w{@code{Choose your default
-app mode}}); then restart Emacs.
+bars and scroll bars by default follow the system's Light or Dark
+mode, similar to other programs such as Explorer and Command Prompt.
+To change the color mode, select @code{Personalization} from
+@w{@code{Windows Settings}}, then @w{@code{Colors->Choose your color}}
+(or @w{@code{Choose your default app mode}} or @w{@code{Choose your
+mode}}); then restart Emacs. On Windows 11, you can select separate
+default modes for Windows and for applications.
+
+@vindex w32-follow-system-dark-mode
+ If you don't want Emacs to follow the system's Dark mode setting,
+customize the variable @code{w32-follow-system-dark-mode} to a
+@code{nil} value; then Emacs will use the default Light mode
+regardless of system-wide settings. Changing the value of this
+variable affects only the Emacs frames created after the change, so
+you should set its value in your init file (@pxref{Init File}), either
+directly or via @kbd{M-x customize-variable}, which lets you save the
+customized value, see @ref{Saving Customizations}.
@ifnottex
@include msdos-xtra.texi
diff --git a/etc/NEWS b/etc/NEWS
index dd4a9c2afcf..ee113e5614e 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -1880,6 +1880,16 @@ always omitted, and ignored if present when the object
is read back in.
* Changes in Emacs 30.1 on Non-Free Operating Systems
+** MS-Windows
+
++++
+*** You can now opt out of following the system's Dark mode.
+By default, Emacs on MS-Windows follows the system's Dark mode for its
+title bars' and scroll bars' appearance. If the new user option
+'w32-follow-system-dark-mode' is customized to the nil value, Emacs
+will disregard the system's Dark mode and will always use the default
+Light mode.
+
----------------------------------------------------------------------
This file is part of GNU Emacs.
diff --git a/lisp/cus-start.el b/lisp/cus-start.el
index 36879029282..7e0b64e9067 100644
--- a/lisp/cus-start.el
+++ b/lisp/cus-start.el
@@ -606,6 +606,8 @@ This should only be chosen under exceptional circumstances,
since it could result in memory overflow and make Emacs crash."
nil))
"27.1")
+ ;; w32fns.c
+ (w32-follow-system-dark-mode display boolean "30.1")
;; window.c
(temp-buffer-show-function windows (choice (const nil) function))
(next-screen-context-lines windows integer)
diff --git a/src/w32fns.c b/src/w32fns.c
index f44460e52c0..8d4bd00b91c 100644
--- a/src/w32fns.c
+++ b/src/w32fns.c
@@ -2376,7 +2376,7 @@ w32_init_class (HINSTANCE hinst)
static void
w32_applytheme (HWND hwnd)
{
- if (w32_darkmode)
+ if (w32_darkmode && w32_follow_system_dark_mode)
{
/* Set window theme to that of a built-in Windows app (Explorer),
because it has dark scroll bars and other UI elements. */
@@ -11393,6 +11393,14 @@ This variable is used for debugging, and takes
precedence over any
value of the `inhibit-double-buffering' frame parameter. */);
w32_disable_double_buffering = false;
+ DEFVAR_BOOL ("w32-follow-system-dark-mode", w32_follow_system_dark_mode,
+ doc: /* Whether to follow the system's Dark mode on MS-Windows.
+If this is nil, Emacs on MS-Windows will not follow the system's Dark
+mode as far as the appearance of title bars and scroll bars is
+concerned, it will always use the default Light mode instead.
+Changing the value takes effect only for frames created after the change. */);
+ w32_follow_system_dark_mode = true;
+
if (os_subtype == OS_SUBTYPE_NT)
w32_unicode_gui = 1;
else
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- master 58f0603d40d: Allow users to opt out of following Windows Dark mode,
Eli Zaretskii <=