diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/Compositor.cpp | 5 | ||||
| -rw-r--r-- | src/managers/WelcomeManager.cpp | 31 | ||||
| -rw-r--r-- | src/managers/WelcomeManager.hpp | 16 |
3 files changed, 52 insertions, 0 deletions
diff --git a/src/Compositor.cpp b/src/Compositor.cpp index e8829fd0..c8bd45fe 100644 --- a/src/Compositor.cpp +++ b/src/Compositor.cpp @@ -60,6 +60,7 @@ #include "managers/HookSystemManager.hpp" #include "managers/ProtocolManager.hpp" #include "managers/LayoutManager.hpp" +#include "managers/WelcomeManager.hpp" #include "render/AsyncResourceGatherer.hpp" #include "plugins/PluginSystem.hpp" #include "hyprerror/HyprError.hpp" @@ -603,6 +604,7 @@ void CCompositor::cleanup() { g_pEventLoopManager.reset(); g_pVersionKeeperMgr.reset(); g_pDonationNagManager.reset(); + g_pWelcomeManager.reset(); g_pANRManager.reset(); g_pConfigWatcher.reset(); g_pAsyncResourceGatherer.reset(); @@ -708,6 +710,9 @@ void CCompositor::initManagers(eManagersInitStage stage) { Debug::log(LOG, "Creating the DonationNag!"); g_pDonationNagManager = makeUnique<CDonationNagManager>(); + Debug::log(LOG, "Creating the WelcomeManager!"); + g_pWelcomeManager = makeUnique<CWelcomeManager>(); + Debug::log(LOG, "Creating the ANRManager!"); g_pANRManager = makeUnique<CANRManager>(); diff --git a/src/managers/WelcomeManager.cpp b/src/managers/WelcomeManager.cpp new file mode 100644 index 00000000..fdbbadfe --- /dev/null +++ b/src/managers/WelcomeManager.cpp @@ -0,0 +1,31 @@ +#include "WelcomeManager.hpp" +#include "../debug/Log.hpp" +#include "../config/ConfigValue.hpp" +#include "../helpers/fs/FsUtils.hpp" + +#include <hyprutils/os/Process.hpp> + +using namespace Hyprutils::OS; + +CWelcomeManager::CWelcomeManager() { + static auto PAUTOGEN = CConfigValue<Hyprlang::INT>("autogenerated"); + + if (!*PAUTOGEN) { + Debug::log(LOG, "[welcome] skipping, not autogen"); + return; + } + + if (!NFsUtils::executableExistsInPath("hyprland-welcome")) { + Debug::log(LOG, "[welcome] skipping, no welcome app"); + return; + } + + m_fired = true; + + CProcess welcome("hyprland-welcome", {}); + welcome.runAsync(); +} + +bool CWelcomeManager::fired() { + return m_fired; +} diff --git a/src/managers/WelcomeManager.hpp b/src/managers/WelcomeManager.hpp new file mode 100644 index 00000000..1f0535eb --- /dev/null +++ b/src/managers/WelcomeManager.hpp @@ -0,0 +1,16 @@ +#pragma once + +#include "../helpers/memory/Memory.hpp" + +class CWelcomeManager { + public: + CWelcomeManager(); + + // whether the welcome screen was shown this boot. + bool fired(); + + private: + bool m_fired = false; +}; + +inline UP<CWelcomeManager> g_pWelcomeManager;
\ No newline at end of file |
