Skip to content

Commit 2cadc8a

Browse files
vaxerskifufexan
andauthored
welcome: init welcome manager (#12409)
--------- Co-authored-by: Mihai Fufezan <[email protected]>
1 parent f82a863 commit 2cadc8a

File tree

4 files changed

+70
-18
lines changed

4 files changed

+70
-18
lines changed

flake.lock

Lines changed: 18 additions & 18 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Compositor.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@
6060
#include "managers/HookSystemManager.hpp"
6161
#include "managers/ProtocolManager.hpp"
6262
#include "managers/LayoutManager.hpp"
63+
#include "managers/WelcomeManager.hpp"
6364
#include "render/AsyncResourceGatherer.hpp"
6465
#include "plugins/PluginSystem.hpp"
6566
#include "hyprerror/HyprError.hpp"
@@ -603,6 +604,7 @@ void CCompositor::cleanup() {
603604
g_pEventLoopManager.reset();
604605
g_pVersionKeeperMgr.reset();
605606
g_pDonationNagManager.reset();
607+
g_pWelcomeManager.reset();
606608
g_pANRManager.reset();
607609
g_pConfigWatcher.reset();
608610
g_pAsyncResourceGatherer.reset();
@@ -708,6 +710,9 @@ void CCompositor::initManagers(eManagersInitStage stage) {
708710
Debug::log(LOG, "Creating the DonationNag!");
709711
g_pDonationNagManager = makeUnique<CDonationNagManager>();
710712

713+
Debug::log(LOG, "Creating the WelcomeManager!");
714+
g_pWelcomeManager = makeUnique<CWelcomeManager>();
715+
711716
Debug::log(LOG, "Creating the ANRManager!");
712717
g_pANRManager = makeUnique<CANRManager>();
713718

src/managers/WelcomeManager.cpp

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#include "WelcomeManager.hpp"
2+
#include "../debug/Log.hpp"
3+
#include "../config/ConfigValue.hpp"
4+
#include "../helpers/fs/FsUtils.hpp"
5+
6+
#include <hyprutils/os/Process.hpp>
7+
8+
using namespace Hyprutils::OS;
9+
10+
CWelcomeManager::CWelcomeManager() {
11+
static auto PAUTOGEN = CConfigValue<Hyprlang::INT>("autogenerated");
12+
13+
if (!*PAUTOGEN) {
14+
Debug::log(LOG, "[welcome] skipping, not autogen");
15+
return;
16+
}
17+
18+
if (!NFsUtils::executableExistsInPath("hyprland-welcome")) {
19+
Debug::log(LOG, "[welcome] skipping, no welcome app");
20+
return;
21+
}
22+
23+
m_fired = true;
24+
25+
CProcess welcome("hyprland-welcome", {});
26+
welcome.runAsync();
27+
}
28+
29+
bool CWelcomeManager::fired() {
30+
return m_fired;
31+
}

src/managers/WelcomeManager.hpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#pragma once
2+
3+
#include "../helpers/memory/Memory.hpp"
4+
5+
class CWelcomeManager {
6+
public:
7+
CWelcomeManager();
8+
9+
// whether the welcome screen was shown this boot.
10+
bool fired();
11+
12+
private:
13+
bool m_fired = false;
14+
};
15+
16+
inline UP<CWelcomeManager> g_pWelcomeManager;

0 commit comments

Comments
 (0)