summaryrefslogtreecommitdiff
path: root/src/managers/WelcomeManager.cpp
blob: b4be21caa2ac9a6d13eeb6c7a7b2b6b22b29637a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#include "WelcomeManager.hpp"
#include "../Compositor.hpp"
#include "../debug/log/Logger.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<Config::INTEGER>("autogenerated");

    if (!*PAUTOGEN) {
        Log::logger->log(Log::DEBUG, "[welcome] skipping, not autogen");
        return;
    }

    if (g_pCompositor->m_safeMode) {
        Log::logger->log(Log::DEBUG, "[welcome] skipping, safe mode");
        return;
    }

    if (!NFsUtils::executableExistsInPath("hyprland-welcome")) {
        Log::logger->log(Log::DEBUG, "[welcome] skipping, no welcome app");
        return;
    }

    m_fired = true;

    CProcess welcome("hyprland-welcome", {});
    welcome.runAsync();
}

bool CWelcomeManager::fired() {
    return m_fired;
}