From 6b2b7e575c2ffae0ec39198f186e2599afcbbb36 Mon Sep 17 00:00:00 2001 From: Joshua Ashton Date: Sat, 23 Jul 2022 12:15:47 +0000 Subject: [PATCH] main: Import systemd/dbus variables for portals Initialize systemd and dbus with our relevant variables which are needed for some desktop portal use. This fixes things such as OBS screen casting not working. In the worst case, on non-systemd/dbus systems, this will just not do anything. Signed-off-by: Joshua Ashton --- src/main.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/main.c b/src/main.c index 0cb521b5..d8166f01 100644 --- a/src/main.c +++ b/src/main.c @@ -92,6 +92,15 @@ main(int argc, char *argv[]) server_init(&server); server_start(&server); + /* Initialize systemd and dbus with our relevant variables + * which are needed for some desktop portal use. + * + * This fixes things such as OBS screen casting not working. + * In the worst case, on non-systemd/dbus systems, this will just not do anything. + */ + system("systemctl --user import-environment DISPLAY WAYLAND_DISPLAY XDG_CURRENT_DESKTOP"); + system("dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY XDG_CURRENT_DESKTOP"); + struct theme theme = { 0 }; theme_init(&theme, rc.theme_name); rc.theme = &theme;