hyprland共享屏幕失败,查看日志报错

journalctl --user -xeu xdg-desktop-portal-hyprland.service

Jul 07 11:19:19 archlinux xdg-desktop-portal-hyprland[34302]: [LOG] Initializing xdph...
Jul 07 11:19:19 archlinux xdg-desktop-portal-hyprland[34302]: [CRITICAL] Couldn't create the dbus connection ([org.freedesktop.DBus.Error.FileExists] Failed to request bus name (File exists))
Jul 07 11:19:19 archlinux systemd[1016]: xdg-desktop-portal-hyprland.service: Main process exited, code=exited, status=1/FAILURE

hyprland配置文件加上一句执行脚本 exec-once reset-desktop-portal.sh

再创建文件 .config/hyprland/reset-desktop-portal.sh,文件内容:

#!/bin/sh
sleep 1
killall -e xdg-desktop-portal-hyprland
killall xdg-desktop-portal
/usr/lib/xdg-desktop-portal-hyprland &
sleep 2
/usr/lib/xdg-desktop-portal &

再给这个文件夹加上执行权限:
chmod ug+x .config/hyprland/reset-desktop-portal.sh

应该就好了