A tiny webserver that allows setting your macOS appearance to light or dark mode remotely.
Controlling the appearance like this can be useful if you want to change it based on smart home automations.
If you run a MacBook with an ambient light sensor, I highly encourage you to use DarkModeBuddy instead.
The webserver is accepting POST
requests to the /appearance
endpoint with the body being either "light"
or "dark"
. The default port is 18471.
curl -X POST http://localhost:18471/appearance -d "light"
- clone this repository into a directory of your choice and
cd
into it - change
com.awaescher.remode.plist
:- define the absolute (!) path to the python exectable
- use
where python3
to find it, it should be pre-installed with macOS
- use
- define the absolute (!) path of
remode-server.py
- define the absolute (!) path to the python exectable
- (optional) change the port in
remode-server.py
if you don't like the default 18471 - make the python script executable
chmod +x remode-server.py
- place the plist in LaunchAgents:
sudo cp com.awaescher.remode.plist ~/Library/LaunchAgents/com.awaescher.remode.plist
- run a manual test by ...
- starting the server with
python3 remode-server.py
- checking if your webserver works with
curl -X POST http://localhost:18471/appearance -d "dark"
(or"light"
)
- starting the server with
- make sure this works, then restart and check again with curl whether the server got started with macOS automatically
- Delete the LaunchAgent with
rm -f ~/Library/LaunchAgents/com.awaescher.remode.plist
- Restart
- Delete the cloned folder