mirror of
https://github.com/labwc/labwc.git
synced 2026-04-04 07:15:41 -04:00
Handle xwayland not started (when HAVE_XWAYLAND, but lacking the binary)
Closes https://github.com/labwc/labwc/issues/434
This commit is contained in:
parent
4e25347791
commit
fee38bceca
5 changed files with 37 additions and 14 deletions
|
|
@ -21,7 +21,6 @@
|
|||
#include "labwc.h"
|
||||
|
||||
static const char *const env_vars[] = {
|
||||
"DISPLAY",
|
||||
"WAYLAND_DISPLAY",
|
||||
"XDG_CURRENT_DESKTOP",
|
||||
"XCURSOR_SIZE",
|
||||
|
|
@ -208,6 +207,21 @@ should_update_activation(void)
|
|||
return have_drm;
|
||||
}
|
||||
|
||||
static void
|
||||
execute_update(const char *env_keys, const char *env_unset_keys, bool initialize)
|
||||
{
|
||||
char *cmd =
|
||||
strdup_printf("dbus-update-activation-environment %s",
|
||||
initialize ? env_keys : env_unset_keys);
|
||||
spawn_async_no_shell(cmd);
|
||||
free(cmd);
|
||||
|
||||
cmd = strdup_printf("systemctl --user %s %s",
|
||||
initialize ? "import-environment" : "unset-environment", env_keys);
|
||||
spawn_async_no_shell(cmd);
|
||||
free(cmd);
|
||||
}
|
||||
|
||||
static void
|
||||
update_activation_env(bool initialize)
|
||||
{
|
||||
|
|
@ -227,19 +241,18 @@ update_activation_env(bool initialize)
|
|||
char *env_keys = str_join(env_vars, "%s", " ");
|
||||
char *env_unset_keys = initialize ? NULL : str_join(env_vars, "%s=", " ");
|
||||
|
||||
char *cmd =
|
||||
strdup_printf("dbus-update-activation-environment %s",
|
||||
initialize ? env_keys : env_unset_keys);
|
||||
spawn_async_no_shell(cmd);
|
||||
free(cmd);
|
||||
|
||||
cmd = strdup_printf("systemctl --user %s %s",
|
||||
initialize ? "import-environment" : "unset-environment", env_keys);
|
||||
spawn_async_no_shell(cmd);
|
||||
free(cmd);
|
||||
execute_update(env_keys, env_unset_keys, initialize);
|
||||
|
||||
free(env_keys);
|
||||
free(env_unset_keys);
|
||||
|
||||
#if HAVE_XWAYLAND
|
||||
if (server.xwayland) {
|
||||
// DISPLAY is only set if xwayland was initialized successfully,
|
||||
// so we only update the env in that case
|
||||
execute_update("DISPLAY", "DISPLAY=", initialize);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue