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 <joshua@froggi.es>
This commit is contained in:
Joshua Ashton 2022-07-23 12:15:47 +00:00
parent dc9c4a93ae
commit 6b2b7e575c

View file

@ -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;