[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Detecting changes between dark and light mode on Mac OS
From: |
Daphne Preston-Kendal |
Subject: |
Detecting changes between dark and light mode on Mac OS |
Date: |
Tue, 9 Mar 2021 14:23:18 +0100 |
Hello,
I've attempted to implement support for detecting and responding to
changes between system dark and light mode on Mac OS.
This patch makes it so that the ns-appearance parameter of a frame is
always bound — if it isn't set by the user, it's set to 'dark or
'light depending on the operating system's default setting. It also
listens for changes in the systemwide appearance, changes the
ns-appearance on all frames when that happens, and runs a new hook,
ns-dark-mode-change-hook. (It's still possible to set ns-appearance on
a frame-by-frame basis, but such changes will be overridden the next
time the systemwide appearance changes.)
This enables users to automatically set Emacs to change their theme
when the system changes from dark to light, for example. (Since
Mac OS 10.15, there is a mode in the system which automatically
changes to dark mode in the evening and light mode during the day;
various third-party utilities existed to provide similar behaviour
before 10.15. So this helps Emacs follow that automatic change,
for example.)
This is my first Emacs patch, and also the first time I've written
Objective-C in probably ten years. So there are probably still
gremlins lurking here and there, and I'd appreciate feedback!
Many thanks
Daphne Preston-Kendal
0001-auto-detection-of-ns-appearance-and-an-ns-dark-mode-.patch
Description: Binary data
- Detecting changes between dark and light mode on Mac OS,
Daphne Preston-Kendal <=
- Re: Detecting changes between dark and light mode on Mac OS, Daphne Preston-Kendal, 2021/03/20
- Re: Detecting changes between dark and light mode on Mac OS, Matt Armstrong, 2021/03/23
- Re: Detecting changes between dark and light mode on Mac OS, Lars Ingebrigtsen, 2021/03/24
- Re: Detecting changes between dark and light mode on Mac OS, Stefan Monnier, 2021/03/25
- Re: Detecting changes between dark and light mode on Mac OS, chad, 2021/03/27
Re: Detecting changes between dark and light mode on Mac OS, Alan Third, 2021/03/21