![如何在 WSL2(Ubuntu 23.10)中为 Epiphany 浏览器(flatpak)设置暗模式?](https://linux22.com/image/1200193/%E5%A6%82%E4%BD%95%E5%9C%A8%20WSL2%EF%BC%88Ubuntu%2023.10%EF%BC%89%E4%B8%AD%E4%B8%BA%20Epiphany%20%E6%B5%8F%E8%A7%88%E5%99%A8%EF%BC%88flatpak%EF%BC%89%E8%AE%BE%E7%BD%AE%E6%9A%97%E6%A8%A1%E5%BC%8F%EF%BC%9F.png)
我在 Windows 11 WSL2 中运行 Ubuntu(预览版),即 Ubuntu 23.10。我安装了 Flatpak,然后从那里安装了 Gnome Web 浏览器,又名 Epiphany。我不知道如何将浏览器主题设置为暗黑模式。
在 Epiphany 设置中,在“外观”下,有“浅色”和“深色”主题选项,但选择深色没有任何作用,即使重新启动浏览器(甚至重新启动整个 Ubuntu VM)也是如此。浏览器窗口仍然是白色的。
我尝试过以下解决方案:
sudo apt install gnome-tweaks gsettings set org.gnome.shell.ubuntu color-scheme prefer-dark gsettings set org.gnome.desktop.interface gtk-theme Yaru-dark gsettings set org.gnome.desktop.interface color-scheme prefer-dark gsettings reset org.gnome.shell.ubuntu color-scheme
gsettings set org.gnome.desktop.interface gtk-theme Adwaita-dark gsettings set org.gnome.desktop.interface color-scheme prefer-dark
flatpak install org.gtk.Gtk3theme.Yaru
添加
GTK_THEME=Adwaita:dark
到/etc/environment
文件
sudo apt install dbus-x11
将以下内容添加到“~/.config/gtk-3.0/settings.ini
and
~/.config/gtk-4.0/settings.ini”文件中:[Settings] gtk-application-prefer-dark-theme=1
这是 WSL2 的一个限制,导致颜色主题被破坏了吗?(注意:我正在使用 WSL2 的内置 GUI 渲染器,我相信它被称为 WSLg。我更希望针对这种情况找到解决方案,而不是使用其他 x-server 的解决方法。)
PS 如果相关的话,这是我从终端启动 Epiphany 时的 bash 输出:
Note that the directories
'/var/lib/flatpak/exports/share'
'/root/.local/share/flatpak/exports/share'
are not in the search path set by the XDG_DATA_DIRS environment variable, so
applications installed by Flatpak may not appear on your desktop until the
session is restarted.
(epiphany:2): Gdk-WARNING **: 00:41:41.376: Failed to read portal settings: GDBus.Error:org.freedesktop.DBus.Error.UnknownMethod: No such interface “org.freedesktop.portal.Settings” on object at path /org/freedesktop/portal/desktop
MESA: error: ZINK: failed to choose pdev
libEGL warning: egl: failed to create dri2 screen
(epiphany:2): epiphany-WARNING **: 00:41:41.589: Failed to search secrets in password schema: org.freedesktop.DBus.Error.ServiceUnknown
(process:2): Gdk-WARNING **: 00:41:41.671: Failed to read portal settings: GDBus.Error:org.freedesktop.DBus.Error.UnknownMethod: No such interface “org.freedesktop.portal.Settings” on object at path /org/freedesktop/portal/desktop
libEGL warning: MESA-LOADER: failed to open vgem: /usr/lib/x86_64-linux-gnu/GL/default/lib/dri/vgem_dri.so: cannot open shared object file: No such file or directory (search paths /usr/lib/x86_64-linux-gnu/GL/default/lib/dri, suffix _dri)
libEGL warning: MESA-LOADER: failed to open vgem: /usr/lib/x86_64-linux-gnu/GL/default/lib/dri/vgem_dri.so: cannot open shared object file: No such file or directory (search paths /usr/lib/x86_64-linux-gnu/GL/default/lib/dri, suffix _dri)
Unable to access the GBM device, disabling DMABuf video sink.