diff options
author | trianta <[email protected]> | 2024-09-05 11:26:46 -0500 |
---|---|---|
committer | GitHub <[email protected]> | 2024-09-05 17:26:46 +0100 |
commit | bd6d6e7f3378c08fe48c179ba4ec3517fe10ae3f (patch) | |
tree | 5f50dea8f863e5d5ae77cb3e088440dff8d84ff6 /src/config/ConfigManager.cpp | |
parent | 027140b7315efe3cd2e7b78fa608bd36da839894 (diff) | |
download | Hyprland-bd6d6e7f3378c08fe48c179ba4ec3517fe10ae3f.tar.gz Hyprland-bd6d6e7f3378c08fe48c179ba4ec3517fe10ae3f.zip |
xwayland: add option to enable/disable xwayland (#7633)
* config: add xwayland enabled option to config
* xwayland: use DISPLAY env variable for enable/disable of new launches
* xwayland: close X11 windows when turning of XWayland
* clang: format fix
* config: add better description for xwayland:enabled
* xwayland: close X11 windows on disable without crashes
* xwayland: better method of informing CXWayland if xwayland enabled
* xwayland: prevent closing non-xwayland windows on disable
* misc: loop formatting
Diffstat (limited to 'src/config/ConfigManager.cpp')
-rw-r--r-- | src/config/ConfigManager.cpp | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/config/ConfigManager.cpp b/src/config/ConfigManager.cpp index 5940a6fe..740dbbdf 100644 --- a/src/config/ConfigManager.cpp +++ b/src/config/ConfigManager.cpp @@ -6,6 +6,7 @@ #include "config/ConfigValue.hpp" #include "helpers/varlist/VarList.hpp" #include "../protocols/LayerShell.hpp" +#include "../xwayland/XWayland.hpp" #include <cstddef> #include <cstdint> @@ -523,6 +524,7 @@ CConfigManager::CConfigManager() { m_pConfig->addConfigValue("gestures:workspace_swipe_touch", Hyprlang::INT{0}); m_pConfig->addConfigValue("gestures:workspace_swipe_touch_invert", Hyprlang::INT{0}); + m_pConfig->addConfigValue("xwayland:enabled", Hyprlang::INT{1}); m_pConfig->addConfigValue("xwayland:use_nearest_neighbor", Hyprlang::INT{1}); m_pConfig->addConfigValue("xwayland:force_zero_scaling", Hyprlang::INT{0}); @@ -860,6 +862,29 @@ void CConfigManager::postConfigReload(const Hyprlang::CParseResult& result) { ensureVRR(); } +#ifndef NO_XWAYLAND + const auto PENABLEXWAYLAND = std::any_cast<Hyprlang::INT>(m_pConfig->getConfigValue("xwayland:enabled")); + // enable/disable xwayland usage + if (!isFirstLaunch) { + bool prevEnabledXwayland = g_pCompositor->m_bEnableXwayland; + if (PENABLEXWAYLAND != prevEnabledXwayland) { + g_pCompositor->m_bEnableXwayland = PENABLEXWAYLAND; + if (PENABLEXWAYLAND) { + Debug::log(LOG, "xwayland has been enabled"); + } else { + Debug::log(LOG, "xwayland has been disabled, cleaning up..."); + for (auto& w : g_pCompositor->m_vWindows) { + if (w->m_pXDGSurface || !w->m_bIsX11) + continue; + g_pCompositor->closeWindow(w); + } + } + g_pXWayland = std::make_unique<CXWayland>(g_pCompositor->m_bEnableXwayland); + } + } else + g_pCompositor->m_bEnableXwayland = PENABLEXWAYLAND; +#endif + if (!isFirstLaunch && !g_pCompositor->m_bUnsafeState) refreshGroupBarGradients(); |