summaryrefslogtreecommitdiff
path: root/startup.lua
diff options
context:
space:
mode:
author魏曹先生 <1992414357@qq.com>2026-08-14 06:03:02 +0800
committer魏曹先生 <1992414357@qq.com>2026-08-14 06:03:02 +0800
commitae7c3f56a5dff147f553a8f6183151a3944e0215 (patch)
tree36d5585d12bbaa9ea0f3291c29fd1ab0257835fc /startup.lua
parent2030a14afc3753746aa2bd2f36e4b49f590063df (diff)
fix: sync wayland env to systemd and restart xdg portal
Diffstat (limited to 'startup.lua')
-rw-r--r--startup.lua6
1 files changed, 6 insertions, 0 deletions
diff --git a/startup.lua b/startup.lua
index 36206d3..2a8b415 100644
--- a/startup.lua
+++ b/startup.lua
@@ -35,4 +35,10 @@ hl.on("hyprland.start", function()
-- FCITX5
hl.exec_cmd("fcitx5 --replace -d")
+
+ -- 修复 xdg-desktop-portal:把 Wayland 会话环境同步给 systemd 用户会话,
+ -- 并重启 portal(否则 xdph 会以 "Couldn't connect to a wayland compositor" 失败,
+ -- 回退到 gtk.portal,导致屏幕共享等不可用)
+ hl.exec_cmd("dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP HYPRLAND_INSTANCE_SIGNATURE")
+ hl.exec_cmd("systemctl --user restart xdg-desktop-portal-hyprland.service xdg-desktop-portal.service")
end)