kands-code
(Kevin Stephen)
August 25, 2026, 9:41am
1
问题描述
我的图形环境是 Niri + DMS,目前基本功能正常,但是对于 Flatpak 的使用还有部分问题:
字体渲染有问题,间隔以及字形都不太正确,使用 flatpak enter com.qq.QQ bash 使用 fc-list 可以看到系统的其他字体,不知道后续该如何继续排错,其中,我并没有使用 Noto Sans CJK 和 Noto Serif CJK,而是使用了 Source Han Sans 和 Source Han Serif,或许这就是原因?
通过 Flatseal,我无法设置 Portal 相关的内容,但是似乎可以正常使用,QQ 的通知也可以使用,输入法也正常,如果光标指着选项,会显示“门户(portal)数据还未配置”
XDG Autorun 似乎也有一些问题,例如通过 Flatpak 安装的 Fcitx5 输入法,在 Gnome 下是可以正常使用的,但是在目前 Niri + DMS 下,不能正常启动,需要我手动 flatpak run org.fcitx.Fcitx5 -rd 重启一次才正常,而通过 pacman 安装的 fcitx5 似乎没有类似的问题
截图
Portal 状态确认
$ systemctl status --user xdg-desktop-portal-gnome.service --no-pager -l
● xdg-desktop-portal-gnome.service - Portal service (GNOME implementation)
Loaded: loaded (/usr/lib/systemd/user/xdg-desktop-portal-gnome.service; static)
Active: active (running) since Tue 2026-08-25 16:57:49 CST; 34min ago
Invocation: e491beb40e0143e8bb6916271ae4c132
Main PID: 1284 (xdg-desktop-por)
Tasks: 11 (limit: 16532)
Memory: 37M (peak: 38.6M)
CPU: 1.786s
CGroup: /user.slice/user-1000.slice/user@1000.service/app.slice/xdg-desktop-portal-gnome.service
└─1284 /usr/lib/xdg-desktop-portal-gnome
8月 25 17:23:34 ksp xdg-desktop-portal-gnome[1284]: Failed to associate portal window with parent window
8月 25 17:23:35 ksp xdg-desktop-portal-gnome[1284]: vkAcquireNextImageKHR(): A swapchain no longer matches the surface properties exactly, but can still be used to present to the surface successfully. (VK_SUBOPTIMAL_KHR) (1000001003)
8月 25 17:23:44 ksp xdg-desktop-portal-gnome[1284]: Failed to associate portal window with parent window
8月 25 17:23:44 ksp xdg-desktop-portal-gnome[1284]: vkAcquireNextImageKHR(): A swapchain no longer matches the surface properties exactly, but can still be used to present to the surface successfully. (VK_SUBOPTIMAL_KHR) (1000001003)
8月 25 17:23:55 ksp xdg-desktop-portal-gnome[1284]: Failed to associate portal window with parent window
8月 25 17:23:55 ksp xdg-desktop-portal-gnome[1284]: vkAcquireNextImageKHR(): A swapchain no longer matches the surface properties exactly, but can still be used to present to the surface successfully. (VK_SUBOPTIMAL_KHR) (1000001003)
8月 25 17:24:09 ksp xdg-desktop-portal-gnome[1284]: Failed to associate portal window with parent window
8月 25 17:24:09 ksp xdg-desktop-portal-gnome[1284]: vkAcquireNextImageKHR(): A swapchain no longer matches the surface properties exactly, but can still be used to present to the surface successfully. (VK_SUBOPTIMAL_KHR) (1000001003)
8月 25 17:24:17 ksp xdg-desktop-portal-gnome[1284]: Failed to associate portal window with parent window
8月 25 17:24:17 ksp xdg-desktop-portal-gnome[1284]: vkAcquireNextImageKHR(): A swapchain no longer matches the surface properties exactly, but can still be used to present to the surface successfully. (VK_SUBOPTIMAL_KHR) (1000001003)
$ systemctl status --user xdg-desktop-portal-gtk.service --no-pager -l
● xdg-desktop-portal-gtk.service - Portal service (GTK/GNOME implementation)
Loaded: loaded (/usr/lib/systemd/user/xdg-desktop-portal-gtk.service; static)
Active: active (running) since Tue 2026-08-25 16:57:50 CST; 35min ago
Invocation: 95a6a352dd584b44bc9bae5bae4256b0
Main PID: 1355 (xdg-desktop-por)
Tasks: 8 (limit: 16532)
Memory: 10.1M (peak: 13.3M)
CPU: 331ms
CGroup: /user.slice/user-1000.slice/user@1000.service/app.slice/xdg-desktop-portal-gtk.service
└─1355 /usr/lib/xdg-desktop-portal-gtk
8月 25 16:57:49 ksp systemd[1097]: Starting Portal service (GTK/GNOME implementation)...
8月 25 16:57:50 ksp systemd[1097]: Started Portal service (GTK/GNOME implementation).
Fastfetch
$ fastfetch --config neofetch.jsonc --logo none
kands@ksp
---------
OS: Arch Linux x86_64
Host: 81YN (Lenovo XiaoXinAir-14ARE 2020)
Kernel: 7.1.9-zen1-2-zen
Uptime: 39 mins
Packages: 7 (flatpak), 657 (pacman)
Shell: bash 5.3.15
Resolution: 1920x1080
WM: niri 26.04 (Wayland)
Terminal: kitty 0.48.2
Terminal Font: MapleMono-NF-CN-Regular 12
CPU: AMD Ryzen 5 4600U (12) @ 4.000GHz
GPU: Radeon Vega Series / Radeon Vega Mobile Series
Memory: 3454MiB / 13833MiB
依云
(lilydjwg)
August 25, 2026, 9:50am
2
kands-code:
字体渲染有问题,间隔以及字形都不太正确,使用 flatpak enter com.qq.QQ bash 使用 fc-list 可以看到系统的其他字体,不知道后续该如何继续排错,其中,我并没有使用 Noto Sans CJK 和 Noto Serif CJK,而是使用了 Source Han Sans 和 Source Han Serif,或许这就是原因?
fc-match sans看看?另外看看locale。
kands-code:
通过 Flatpak 安装的 Fcitx5 输入法,在 Gnome 下是可以正常使用的,但是在目前 Niri + DMS 下,不能正常启动
那就不要用flatpak安装它?听起来像是启动时机不太好。
kands-code
(Kevin Stephen)
August 25, 2026, 10:27am
3
$ fc-match sans
Fontconfig error: No writable cache directories
/usr/lib/fontconfig/cache
/app/cache/fontconfig
/.cache/fontconfig
/run/host/fonts-cache
/run/host/user-fonts-cache
Fontconfig error: No writable cache directories
/usr/lib/fontconfig/cache
/app/cache/fontconfig
/.cache/fontconfig
/run/host/fonts-cache
/run/host/user-fonts-cache
Fontconfig error: No writable cache directories
/usr/lib/fontconfig/cache
/app/cache/fontconfig
/.cache/fontconfig
/run/host/fonts-cache
/run/host/user-fonts-cache
Fontconfig error: No writable cache directories
/usr/lib/fontconfig/cache
/app/cache/fontconfig
/.cache/fontconfig
/run/host/fonts-cache
/run/host/user-fonts-cache
Fontconfig error: No writable cache directories
/usr/lib/fontconfig/cache
/app/cache/fontconfig
/.cache/fontconfig
/run/host/fonts-cache
/run/host/user-fonts-cache
Fontconfig error: No writable cache directories
/usr/lib/fontconfig/cache
/app/cache/fontconfig
/.cache/fontconfig
/run/host/fonts-cache
/run/host/user-fonts-cache
Fontconfig error: No writable cache directories
/usr/lib/fontconfig/cache
/app/cache/fontconfig
/.cache/fontconfig
/run/host/fonts-cache
/run/host/user-fonts-cache
Fontconfig error: No writable cache directories
/usr/lib/fontconfig/cache
/app/cache/fontconfig
/.cache/fontconfig
/run/host/fonts-cache
/run/host/user-fonts-cache
Fontconfig error: No writable cache directories
/usr/lib/fontconfig/cache
/app/cache/fontconfig
/.cache/fontconfig
/run/host/fonts-cache
/run/host/user-fonts-cache
Fontconfig error: No writable cache directories
/usr/lib/fontconfig/cache
/app/cache/fontconfig
/.cache/fontconfig
/run/host/fonts-cache
/run/host/user-fonts-cache
Fontconfig error: No writable cache directories
/usr/lib/fontconfig/cache
/app/cache/fontconfig
/.cache/fontconfig
/run/host/fonts-cache
/run/host/user-fonts-cache
DejaVuSans.ttf: "DejaVu Sans" "Book"
是需要我授权什么权限给 QQ 吗?还是说需要我自己写个 local.conf 挂上去?
另外,确认是可以找到 Source Han Sans CN 的:
$ fc-list | grep "Source Han Sans CN"
Fontconfig error: No writable cache directories
/usr/lib/fontconfig/cache
/app/cache/fontconfig
/.cache/fontconfig
/run/host/fonts-cache
/run/host/user-fonts-cache
Fontconfig error: No writable cache directories
/usr/lib/fontconfig/cache
/app/cache/fontconfig
/.cache/fontconfig
/run/host/fonts-cache
/run/host/user-fonts-cache
Fontconfig error: No writable cache directories
/usr/lib/fontconfig/cache
/app/cache/fontconfig
/.cache/fontconfig
/run/host/fonts-cache
/run/host/user-fonts-cache
Fontconfig error: No writable cache directories
/usr/lib/fontconfig/cache
/app/cache/fontconfig
/.cache/fontconfig
/run/host/fonts-cache
/run/host/user-fonts-cache
Fontconfig error: No writable cache directories
/usr/lib/fontconfig/cache
/app/cache/fontconfig
/.cache/fontconfig
/run/host/fonts-cache
/run/host/user-fonts-cache
Fontconfig error: No writable cache directories
/usr/lib/fontconfig/cache
/app/cache/fontconfig
/.cache/fontconfig
/run/host/fonts-cache
/run/host/user-fonts-cache
Fontconfig error: No writable cache directories
/usr/lib/fontconfig/cache
/app/cache/fontconfig
/.cache/fontconfig
/run/host/fonts-cache
/run/host/user-fonts-cache
Fontconfig error: No writable cache directories
/usr/lib/fontconfig/cache
/app/cache/fontconfig
/.cache/fontconfig
/run/host/fonts-cache
/run/host/user-fonts-cache
Fontconfig error: No writable cache directories
/usr/lib/fontconfig/cache
/app/cache/fontconfig
/.cache/fontconfig
/run/host/fonts-cache
/run/host/user-fonts-cache
Fontconfig error: No writable cache directories
/usr/lib/fontconfig/cache
/app/cache/fontconfig
/.cache/fontconfig
/run/host/fonts-cache
/run/host/user-fonts-cache
Fontconfig error: No writable cache directories
/usr/lib/fontconfig/cache
/app/cache/fontconfig
/.cache/fontconfig
/run/host/fonts-cache
/run/host/user-fonts-cache
/run/host/fonts/adobe-source-han-sans/SourceHanSansCN-Bold.otf: Source Han Sans CN,思源黑体 CN:style=Bold
/run/host/fonts/adobe-source-han-sans/SourceHanSansCN-ExtraLight.otf: Source Han Sans CN,思源黑体 CN,Source Han Sans CN ExtraLight,思源黑体 CN ExtraLight:style=ExtraLight,Regular
/run/host/fonts/adobe-source-han-sans/SourceHanSansCN-Normal.otf: Source Han Sans CN,思源黑体 CN,Source Han Sans CN Normal,思源黑体 CN Normal:style=Normal,Regular
/run/host/fonts/adobe-source-han-sans/SourceHanSansCN-Medium.otf: Source Han Sans CN,思源黑体 CN,Source Han Sans CN Medium,思源黑体 CN Medium:style=Medium,Regular
/run/host/fonts/adobe-source-han-sans/SourceHanSansCN-Light.otf: Source Han Sans CN,思源黑体 CN,Source Han Sans CN Light,思源黑体 CN Light:style=Light,Regular
/run/host/fonts/adobe-source-han-sans/SourceHanSansCN-Heavy.otf: Source Han Sans CN,思源黑体 CN,Source Han Sans CN Heavy,思源黑体 CN Heavy:style=Heavy,Regular
/run/host/fonts/adobe-source-han-sans/SourceHanSansCN-Regular.otf: Source Han Sans CN,思源黑体 CN:style=Regular
依云
(lilydjwg)
August 25, 2026, 10:36am
4
看看fc-match -s sans | head -n 30,思源在第几?
另外看看locale是否设置为了zh_CN。
kands-code
(Kevin Stephen)
August 25, 2026, 10:54am
5
依云:
另外看看locale是否设置为了zh_CN。
并没有:
$ locale
LANG=
LC_CTYPE="POSIX"
LC_NUMERIC="POSIX"
LC_TIME="POSIX"
LC_COLLATE="POSIX"
LC_MONETARY="POSIX"
LC_MESSAGES="POSIX"
LC_PAPER="POSIX"
LC_NAME="POSIX"
LC_ADDRESS="POSIX"
LC_TELEPHONE="POSIX"
LC_MEASUREMENT="POSIX"
LC_IDENTIFICATION="POSIX"
LC_ALL=
至于 fc-match -s sans | head -n 30,完全看不到 思源,看这个列表,中文似乎是 fallback 到了 Maple Mono NF CN:
$ fc-match -s sans 2>/dev/null | head -n 30
DejaVuSans.ttf: "DejaVu Sans" "Book"
DejaVuSans-Bold.ttf: "DejaVu Sans" "Bold"
DejaVuSans-Oblique.ttf: "DejaVu Sans" "Oblique"
DejaVuSans-BoldOblique.ttf: "DejaVu Sans" "Bold Oblique"
NotoSans-Regular.ttf: "Noto Sans" "Regular"
Carlito-Regular.ttf: "Carlito" "Regular"
FreeSans.ttf: "FreeSans" "Regular"
FreeMono.ttf: "FreeMono" "Regular"
FreeSerif.ttf: "FreeSerif" "Regular"
AdwaitaMono-Regular.ttf: "Adwaita Mono" "Regular"
NewCMMath-Book.otf: "NewComputerModern Math" "Book"
NewCMSans10-Book.otf: "NewComputerModern Sans" "10 Book"
NewCM08Devanagari-Book.otf: "NewCM08Devanagari" "Book"
MapleMono-NF-CN-Regular.ttf: "Maple Mono NF CN" "Regular"
NotoNastaliqUrdu-Regular.ttf: "Noto Nastaliq Urdu" "Regular"
NewCMMono10-Regular.otf: "NewComputerModern Mono" "10 Regular"
NotoSansBengali-Regular.ttf: "Noto Sans Bengali" "Regular"
NotoSansAdlamUnjoined-Regular.ttf: "Noto Sans Adlam Unjoined" "Regular"
NotoSansDuployan-Regular.ttf: "Noto Sans Duployan" "Regular"
NotoSansMongolian-Regular.ttf: "Noto Sans Mongolian" "Regular"
NotoSansWarangCiti-Regular.ttf: "Noto Sans Warang Citi" "Regular"
NotoSansHebrew-Regular.ttf: "Noto Sans Hebrew" "Regular"
NotoSansSinhala-Regular.ttf: "Noto Sans Sinhala" "Regular"
DejaVuSerif.ttf: "DejaVu Serif" "Book"
NotoSerifTangut-Regular.ttf: "Noto Serif Tangut" "Regular"
NotoKufiArabic-Regular.ttf: "Noto Kufi Arabic" "Regular"
NotoSansMyanmar-Regular.ttf: "Noto Sans Myanmar" "Regular"
NotoSansGujarati-Regular.ttf: "Noto Sans Gujarati" "Regular"
NotoSansMalayalam-Regular.ttf: "Noto Sans Malayalam" "Regular"
NotoSerifTibetan-Regular.ttf: "Noto Serif Tibetan" "Regular"
另外,我已经使用了 flatpak override --user --filesystem=xdg-config/fontconfig:ro com.qq.QQ,并且尝试了环境变量覆盖,但是都不生效,locale 始终不是 zh_CN
依云
(lilydjwg)
August 25, 2026, 10:58am
6
你需要整一下flatpak里的locale。
另外如果字体顺序不理想的话,你可以手动指定一下。
——至于如何叫flatpak听话我就不知道了。
kands-code
(Kevin Stephen)
August 25, 2026, 11:27am
7
我知道了,我一直被 flatpak enter 给骗了,应该要使用 flatpak run --command=sh com.qq.QQ -c 'locale' 来查看,输出为:
$ flatpak run --command=sh com.qq.QQ -c 'locale'
LANG=zh_CN.UTF-8
LC_CTYPE="zh_CN.UTF-8"
LC_NUMERIC=zh_CN.UTF-8
LC_TIME=ja_JP.UTF-8
LC_COLLATE=zh_CN.UTF-8
LC_MONETARY=zh_CN.UTF-8
LC_MESSAGES="zh_CN.UTF-8"
LC_PAPER=zh_CN.UTF-8
LC_NAME="zh_CN.UTF-8"
LC_ADDRESS="zh_CN.UTF-8"
LC_TELEPHONE="zh_CN.UTF-8"
LC_MEASUREMENT=zh_CN.UTF-8
LC_IDENTIFICATION="zh_CN.UTF-8"
LC_ALL=
完全不需要设置环境变量覆盖,我的环境变量有正确导入的
保险起见,还可以设置 flatpak config --user --set languages zh
另外,关于字体 fallback,我创建了 ~/.config/fontconfig/fonts.conf 文件,然后给所有 Flatpak 应用挂载了 xdg-config/fontconfig:ro,这样设置后,字体表现就正常了
kands-code
(Kevin Stephen)
August 25, 2026, 11:33am
8
不过目前 Portal 以及 Autostart 还是没有什么头绪,主要影响的就是其他帖子也讨论过的屏幕分享,我再看看还有没有其他方法吧
kands-code
(Kevin Stephen)
August 26, 2026, 10:05am
9
关于 Niri 下使用 Flatpak 安装的 Fcitx5 无法正常启动的问题,我问了一下一下 AI ,似乎与 Portal 无关,也不是 Autostart 的问题,而是与 Niri 的安全权限有关,详见 https://github.com/niri-wm/niri/discussions/1773 ,简单说,就是 Fcitx5 这种输入法应用需要监听键盘输入,隐私风险太高,所以被拦下了,导致无法正常使用
但是这个结论我并没有具体核查,自然也不知道推理是否正确,只是留一个记录,等日后再次尝试 Niri 的时候看看有没有什么改变
依云
(lilydjwg)
August 26, 2026, 10:20am
10
哦,他们对沙箱里的程序进行了限制,不让用特权协议了。——但这解释不了为什么你重启之后会正常啊。
可以贴一下重启前后fcitx5-diagnose的输出。
kands-code
(Kevin Stephen)
August 26, 2026, 10:26am
11
嘛,并不是 100% 能够恢复“正常”,我也不知道为什么我可以使用,或许我无意中跟着 AI 做了一些什么设置绕开了这个安全限制,不过已经不知道了,因我换回到了 GNOME,所以没办法粘贴对应环境的 fcitx5-diagnose 输出了,等之后再遇到类似问题再说吧,感谢您能帮忙排查问题