diff options
author | Vladimir-csp <[email protected]> | 2024-08-15 19:14:48 +0300 |
---|---|---|
committer | GitHub <[email protected]> | 2024-08-15 17:14:48 +0100 |
commit | 15f942000ef53776852d6d9dfd303e691aed73e3 (patch) | |
tree | aa408f5e8aaabb3f9c18228469f98d5c20e08f0e | |
parent | 520e91238f0e6e6990e6a0845d73d85012485525 (diff) | |
download | Hyprland-15f942000ef53776852d6d9dfd303e691aed73e3.tar.gz Hyprland-15f942000ef53776852d6d9dfd303e691aed73e3.zip |
core: Preserve existing XDG_CURRENT_DESKTOP (#7347)
* Preserve existing XDG_CURRENT_DESKTOP
* fix
---------
Co-authored-by: vaxerski <[email protected]>
-rw-r--r-- | src/Compositor.cpp | 7 | ||||
-rw-r--r-- | src/Compositor.hpp | 1 | ||||
-rw-r--r-- | src/main.cpp | 1 |
3 files changed, 7 insertions, 2 deletions
diff --git a/src/Compositor.cpp b/src/Compositor.cpp index 26a985ef..4024fadf 100644 --- a/src/Compositor.cpp +++ b/src/Compositor.cpp @@ -305,6 +305,10 @@ void CCompositor::initServer(std::string socketName, int socketFd) { setenv("WAYLAND_DISPLAY", m_szWLDisplaySocket.c_str(), 1); setenv("XDG_SESSION_TYPE", "wayland", 1); + if (!getenv("XDG_CURRENT_DESKTOP")) { + setenv("XDG_CURRENT_DESKTOP", "Hyprland", 1); + m_bDesktopEnvSet = true; + } initManagers(STAGE_BASICINIT); @@ -422,7 +426,8 @@ void CCompositor::cleanEnvironment() { // in main unsetenv("HYPRLAND_CMD"); unsetenv("XDG_BACKEND"); - unsetenv("XDG_CURRENT_DESKTOP"); + if (m_bDesktopEnvSet) + unsetenv("XDG_CURRENT_DESKTOP"); if (m_pAqBackend->hasSession()) { const auto CMD = diff --git a/src/Compositor.hpp b/src/Compositor.hpp index 5e9e3266..a570a06e 100644 --- a/src/Compositor.hpp +++ b/src/Compositor.hpp @@ -91,6 +91,7 @@ class CCompositor { bool m_bNextIsUnsafe = false; CMonitor* m_pUnsafeOutput = nullptr; // fallback output for the unsafe state bool m_bIsShuttingDown = false; + bool m_bDesktopEnvSet = false; // ------------------------------------------------- // diff --git a/src/main.cpp b/src/main.cpp index e85b0a22..820a248c 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -36,7 +36,6 @@ int main(int argc, char** argv) { setenv("XDG_BACKEND", "wayland", 1); setenv("_JAVA_AWT_WM_NONREPARENTING", "1", 1); setenv("MOZ_ENABLE_WAYLAND", "1", 1); - setenv("XDG_CURRENT_DESKTOP", "Hyprland", 1); // parse some args std::string configPath; |