-
wiliwili 的自动暗黑模式在我的系统上不起作用。我猜想可能是wiliwili读取的环境变量或其它设置没有被我设置,我应该怎么做才能让wiliwili知道我在何种主题? system info
Use darkman 切换脚本我通过让darkman执行脚本,借助脚本设置主题。下面是这些脚本的实现。 Darktheme="Arc-Dark"
xfconf-query -c xsettings -p /Net/ThemeName -s "$theme"
xfconf-query -c xfwm4 -p /general/theme -s "$theme"
gsettings set org.gnome.desktop.interface gtk-theme "$theme" Lighttheme="Quartz Green"
xfconf-query -c xsettings -p /Net/ThemeName -s "$theme"
xfconf-query -c xfwm4 -p /general/theme -s "$theme"
gsettings set org.gnome.desktop.interface gtk-theme "$theme" darkman 目前的工作状况目前这个脚本对GTK和Tauri都能工作的很好。 wiliwili 是怎么识别当前系统主题明暗风格的?如果我能知道wiliwili如何实现的自动切换主题,我就能通过脚本让wiliwili在我的系统上正常工作。 |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
wiliwili目前还不支持运行时检测系统主题。
读取环境变量:BOREALIS_THEME。若未设定,PC平台在 macOS 和 UWP 下自动获取系统主题,其他系统默认为白色主题 BOREALIS_THEME 可能为的值是:DARK / LIGHT
wiliwili/wiliwili/source/utils/config_helper.cpp Lines 485 to 494 in 7541334 |
Beta Was this translation helpful? Give feedback.
-
This can be temporarily solved using a script that gets the theme color scheme at startup and sets the environment variable. Move wiliwili to share dir. #!/bin/env bash
#
# org.freedesktop.appearance color-scheme
#
# Indicates the system's preferred color scheme.
# Supported values are:
#
# 0: No preference
# 1: Prefer dark appearance
# 2: Prefer light appearance
#
# Unknown values should be treated as 0 (no preference).
wiliwili_path=/usr/share/wiliwili/wiliwili
scheme=$(
gdbus call --session --timeout=1000 \
--dest=org.freedesktop.portal.Desktop \
--object-path /org/freedesktop/portal/desktop \
--method org.freedesktop.portal.Settings.Read org.freedesktop.appearance color-scheme
)
wiliwili_boot_dark () {
BOREALIS_THEME=DARK $wiliwili_path
}
wiliwili_boot_light () {
BOREALIS_THEME=LIGHT $wiliwili_path
}
wiliwili_boot_default () {
wiliwili_boot_light
}
case $scheme in
( '(<<uint32 1>>,)' ) wiliwili_boot_dark;;
( '(<<uint32 2>>,)' ) wiliwili_boot_light;;
( * ) wiliwili_boot_default;;
esac
|
Beta Was this translation helpful? Give feedback.
wiliwili目前还不支持运行时检测系统主题。
读取环境变量:BOREALIS_THEME。若未设定,PC平台在 macOS 和 UWP 下自动获取系统主题,其他系统默认为白色主题
https://github.com/xfangfang/borealis/blob/a3e600e5e6f5b0e1bf7546fa47ff075296cf4357/library/lib/platforms/desktop/desktop_platform.cpp#L370-L401
BOREALIS_THEME 可能为的值是:DARK / LIGHT
读取配置目录,如果有应用内强制设定的主题,还会覆盖前面的设置
wiliwili/wiliwili/source/utils/config_helper.cpp
Lines 485 to 494 in 7541334