welcome: init welcome manager (#12409)
--------- Co-authored-by: Mihai Fufezan <mihai@fufexan.net>
This commit is contained in:
parent
f82a8630d7
commit
2cadc8abab
4 changed files with 70 additions and 18 deletions
31
src/managers/WelcomeManager.cpp
Normal file
31
src/managers/WelcomeManager.cpp
Normal file
|
|
@ -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;
|
||||
}
|
||||
16
src/managers/WelcomeManager.hpp
Normal file
16
src/managers/WelcomeManager.hpp
Normal file
|
|
@ -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;
|
||||
Loading…
Add table
Add a link
Reference in a new issue