Open LorenEteval opened 10 months ago
Just tested on Ubuntu 22.04, same steps except for installing darkdetect using pip install darkdetect
. It still fails to print under sudo mode.
darkdetect.theme()
also fails under sudo mode, but it seems that on Ubuntu 22.04 the result is caused by gsettings
and sudo gsettings
giving different output.
I took a quick glance on the implemetation of macOS side, not sure why it would fail because it's just interacting with pyobjc.
Also, because of issue #33 , I have to fall back to combination of darkdetect.theme
+ timer to achieve the same "listener" feature on macOS (non-sudo, packed application).
Hi. Recently I found that darkdetect listener cannot work under sudo mode. This is how I reproduce:
Environment: macOS 13.5.1 Apple Silicon, Python 3.11
Create a new venv, and install darkdetect by
pip install "darkdetect[macos-listener]"
Test
sample.py
as follows:When running with
python sample.py
, the theme is printed correctly when changing system theme in the settings manually.However, if running with
sudo python sample.py
, the callback never called when switching system theme.There are some cases that I want to launch my application as sudo, and found that darkdetect failed to behave as expected.
Is this a bug related to darkdetect, or related to macos-listener implementation under the hood? Will darkdetect fix this in the future? Thanks.