如何在 WSL2(Ubuntu 23.10)中为 Epiphany 浏览器(flatpak)设置暗模式?

如何在 WSL2(Ubuntu 23.10)中为 Epiphany 浏览器(flatpak)设置暗模式?

我在 Windows 11 WSL2 中运行 Ubuntu(预览版),即 Ubuntu 23.10。我安装了 Flatpak,然后从那里安装了 Gnome Web 浏览器,又名 Epiphany。我不知道如何将浏览器主题设置为暗黑模式。

在 Epiphany 设置中,在“外观”下,有“浅色”和“深色”主题选项,但选择深色没有任何作用,即使重新启动浏览器(甚至重新启动整个 Ubuntu VM)也是如此。浏览器窗口仍然是白色的。

我尝试过以下解决方案:

  1. https://code.adonline.id.au/dark-theme-in-wsl2/..
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
  1. https://askubuntu.com/a/1408728/1020711..
gsettings set org.gnome.desktop.interface gtk-theme Adwaita-dark
gsettings set org.gnome.desktop.interface color-scheme prefer-dark
  1. https://askubuntu.com/a/1216263/1020711..

flatpak install org.gtk.Gtk3theme.Yaru

  1. https://www.reddit.com/r/bashonubuntuonwindows/comments/nmsmm9/comment/gzrv2gi/?context=3..

添加GTK_THEME=Adwaita:dark/etc/environment文件

  1. https://github.com/microsoft/wslg/issues/251..

sudo apt install dbus-x11

  1. https://askubuntu.com/a/882515/1020711..

将以下内容添加到“~/.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.

相关内容