bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#68766: 29.2; Windows dark/light mode changes does not reflect on Ema


From: Rahul M. Juliato
Subject: bug#68766: 29.2; Windows dark/light mode changes does not reflect on Emacs Title bar/Scrollbar
Date: Sat, 27 Jan 2024 23:08:45 -0300
User-agent: Gnus/5.13 (Gnus v5.13)

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





reply via email to

[Prev in Thread] Current Thread [Next in Thread]