aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Compositor.cpp
diff options
context:
space:
mode:
authorIkalco <[email protected]>2024-05-08 12:11:08 -0500
committerGitHub <[email protected]>2024-05-08 18:11:08 +0100
commit6a988d9276691957f1d9138f93c2209b580cad13 (patch)
tree6ce5a434e654872949438fc764f738952f3dca28 /src/Compositor.cpp
parentd1ad490cdaaa97d5df83d28e86f02c96107ba142 (diff)
downloadHyprland-6a988d9276691957f1d9138f93c2209b580cad13.tar.gz
Hyprland-6a988d9276691957f1d9138f93c2209b580cad13.zip
core: cleanup environment on exit (#5941)
Diffstat (limited to 'src/Compositor.cpp')
-rw-r--r--src/Compositor.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/Compositor.cpp b/src/Compositor.cpp
index 96831751..11834043 100644
--- a/src/Compositor.cpp
+++ b/src/Compositor.cpp
@@ -341,6 +341,28 @@ void CCompositor::removeAllSignals() {
removeWLSignal(&Events::listen_sessionActive);
}
+void CCompositor::cleanEnvironment() {
+ // in compositor constructor
+ unsetenv("WAYLAND_DISPLAY");
+ // in startCompositor
+ unsetenv("HYPRLAND_INSTANCE_SIGNATURE");
+
+ // in main
+ unsetenv("HYPRLAND_CMD");
+ unsetenv("XDG_BACKEND");
+ unsetenv("XDG_CURRENT_DESKTOP");
+
+ if (m_sWLRSession) {
+ const auto CMD =
+#ifdef USES_SYSTEMD
+ "systemctl --user unset-environment DISPLAY WAYLAND_DISPLAY HYPRLAND_INSTANCE_SIGNATURE XDG_CURRENT_DESKTOP QT_QPA_PLATFORMTHEME && hash "
+ "dbus-update-activation-environment 2>/dev/null && "
+#endif
+ "dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP HYPRLAND_INSTANCE_SIGNATURE QT_QPA_PLATFORMTHEME";
+ g_pKeybindManager->spawn(CMD);
+ }
+}
+
void CCompositor::cleanup() {
if (!m_sWLDisplay || m_bIsShuttingDown)
return;
@@ -358,6 +380,8 @@ void CCompositor::cleanup() {
Systemd::SdNotify(0, "STOPPING=1");
#endif
+ cleanEnvironment();
+
// unload all remaining plugins while the compositor is
// still in a normal working state.
g_pPluginSystem->unloadAllPlugins();