all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Rahul M. Juliato" <rahuljuliato@gmail.com>
To: 68766@debbugs.gnu.org
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	[thread overview]
Message-ID: <87il3enr9u.fsf@gmail.com> (raw)


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	other threads:[~2024-01-28  2:08 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-28  2:08 Rahul M. Juliato [this message]
2024-01-28  2:40 ` bug#68766: 29.2; Windows dark/light mode changes does not reflect on Emacs Title bar/Scrollbar 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87il3enr9u.fsf@gmail.com \
    --to=rahuljuliato@gmail.com \
    --cc=68766@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.