feat(desktop): detect dark theme on Linux via DBus portal #107
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Implement dark theme detection on Linux using org.freedesktop.portal.Settings over DBus, querying the
org.freedesktop.appearance color-schemekey. If the value is 1 (prefer dark), set the app theme to DARK.This improves integration with desktop environments that support the XDG appearance portal.
close xfangfang/wiliwili#181
注1: 由于我不会
C++,此代码大量使用了AI生成。注2: 代码格式风格需要修正。
注3: 在dbus超时时,行为不可知。
我提前为AI生成的低质量代码感到抱歉,但是对于API的用法AI生成应当不会有太大问题,并且在Arch Linux的Gnome上,我已经进行测试,工作正常。
希望此PR可以起到参考作用,加快 xfangfang/wiliwili#181 实现。