Skip to content

Conversation

@yuioto
Copy link

@yuioto yuioto commented Jul 19, 2025

Implement dark theme detection on Linux using org.freedesktop.portal.Settings over DBus, querying the org.freedesktop.appearance color-scheme key. 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 实现。

yuioto added 2 commits July 19, 2025 11:57
Implement dark theme detection on Linux using org.freedesktop.portal.Settings
over DBus, querying the `org.freedesktop.appearance color-scheme` key.
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature Request]: Linux: theme: auto switch

1 participant