unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#68766: 29.2; Windows dark/light mode changes does not reflect on Emacs Title bar/Scrollbar
@ 2024-01-28  2:08 Rahul M. Juliato
  2024-01-28  2:40 ` Stefan Kangas
                   ` (2 more replies)
  0 siblings, 3 replies; 12+ messages in thread
From: Rahul M. Juliato @ 2024-01-28  2:08 UTC (permalink / raw)
  To: 68766


Hello there!

I'm the maintainer of ~auto-dark~ for Emacs. Which is an utility package
aimed to change Emacs theme when the OS changes it's dark/light mode
settings (more here: https://github.com/LionyxML/auto-dark-emacs).

Currently I've been contacted by a Windows user that reported me a
strange behaviour on Emacs 29 with Windows 10/11.

In order to reproduce this behaviour:

1.) Download Emacs from the nearest mirror:

https://mirror.us-midwest-1.nexcess.net/gnu/emacs/windows/emacs-29/emacs-29.1_2.zip

Unzip it and run ~runemacs.exe~.

2.) Prepare a Powershell Script to Toggle between modes during test

Create a file named ~ToggleDarkMode.ps1~ with the following content:

#+BEGIN_SRC ps1
$k = "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize"
$v = (Get-ItemProperty -Path $k).SystemUsesLightTheme -bxor 1

Set-ItemProperty -Path $k -Name "SystemUsesLightTheme" -Value $v
Set-ItemProperty -Path $k -Name "AppsUseLightTheme" -Value $v
#+END_SRC

Open PowerShell as system administrator

Cd into where you created ~ToggleDarkMode.ps1~ and execute it with:

#+BEGIN_SRC shell
powershell.exe -noprofile -executionpolicy bypass -file .\ToggleDarkMode.ps1
#+END_SRC

Executing this will toggle your Windows looks between dark/light modes.

3.) As shown here in this pictures sequence

~https://imgur.com/a/zSSx2tk~

(If you guys have any Libre imgur alternative, please let me know!)


3.1) We open Emacs + calculator + notepad

The only package I have installed is ~auto-dark-mode~, responsible for
changing Emacs theme.

As the testing Windows machine was on Dark Mode when Emacs opened, both
title bar and scrollbar remains as "dark".


3.2) We now run the toggle script (2) again.

All Windows apps be come "light", auto-dark changes the theme to a light
one, but both the title bar and scrollbar remains "dark".


3.3) I now close Emacs and reopen it

Auto-dark changes the theme to "light" and both the title bar and
scrollbar becomes "light".


3.2) We now run the toggle script (2) again.

All windows apps change to "dark", auto-dark puts Emacs theme to dark,
but both title bar and scrollbar remains "light".


And you might continue with this and the results is always the same.


The problem:

It seems Emacs only sets it's title bar and scrollbar colors during
initialization, not during run time.

I do not know if this is "by design" or "a bug", hence my bug-report.

I'd also like to mention that ~auto-dark~ has a hook after changing to
both light/dark modes that could be used to run some extra elisp code if
needed.

Is it possible to change the system title bar/scrollbar colors or "theme"
from inside Emacs with Elisp?

Could we write some Powershell script and call it from Emacs using
~auto-dark~ hooks?


Thanks,

Rahul M. Juliato





^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2024-02-19  1:15 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-01-28  2:08 bug#68766: 29.2; Windows dark/light mode changes does not reflect on Emacs Title bar/Scrollbar Rahul M. Juliato
2024-01-28  2:40 ` Stefan Kangas
2024-01-28  6:42   ` Eli Zaretskii
2024-01-30 19:52     ` Rahul M. Juliato
2024-01-28  6:38 ` Eli Zaretskii
2024-01-29 22:34   ` Stefan Kangas
2024-01-30  7:37     ` Visuwesh
2024-01-30 11:57     ` Rudolf Schlatte
2024-01-30 13:15       ` Eli Zaretskii
2024-01-30 19:57 ` Rahul M. Juliato
2024-02-03  9:57   ` Eli Zaretskii
2024-02-19  1:15     ` Rahul M. Juliato

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).