welcome: init welcome manager (#12409)

---------

Co-authored-by: Mihai Fufezan <mihai@fufexan.net>
This commit is contained in:
Vaxry 2025-12-02 22:26:43 +00:00 committed by GitHub
parent f82a8630d7
commit 2cadc8abab
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 70 additions and 18 deletions

36
flake.lock generated
View file

@ -16,11 +16,11 @@
]
},
"locked": {
"lastModified": 1763922789,
"narHash": "sha256-XnkWjCpeXfip9tqYdL0b0zzBDjq+dgdISvEdSVGdVyA=",
"lastModified": 1764370710,
"narHash": "sha256-7iZklFmziy6Vn5ZFy9mvTSuFopp3kJNuPxL5QAvtmFQ=",
"owner": "hyprwm",
"repo": "aquamarine",
"rev": "a20a0e67a33b6848378a91b871b89588d3a12573",
"rev": "561ae7fbe1ca15dfd908262ec815bf21a13eef63",
"type": "github"
},
"original": {
@ -144,11 +144,11 @@
]
},
"locked": {
"lastModified": 1763727565,
"narHash": "sha256-vRff/2R1U1jzPBy4OODqh2kfUzmizW/nfV2ROzTDIKo=",
"lastModified": 1764616927,
"narHash": "sha256-wRT0MKkpPo11ijSX3KeMN+EQWnpSeUlRtyF3pFLtlRU=",
"owner": "hyprwm",
"repo": "hyprland-guiutils",
"rev": "7724d3a12a0453e7aae05f2ef39474219f05a4b4",
"rev": "25cedbfdc5b3ea391d8307c9a5bea315e5df3c52",
"type": "github"
},
"original": {
@ -193,11 +193,11 @@
]
},
"locked": {
"lastModified": 1763819661,
"narHash": "sha256-0jLarTR/BLWdGlboM86bPVP2zKJNI2jvo3JietnDkOM=",
"lastModified": 1764612430,
"narHash": "sha256-54ltTSbI6W+qYGMchAgCR6QnC1kOdKXN6X6pJhOWxFg=",
"owner": "hyprwm",
"repo": "hyprlang",
"rev": "a318deec0c12409ec39c68d2be8096b636dc2a5c",
"rev": "0d00dc118981531aa731150b6ea551ef037acddd",
"type": "github"
},
"original": {
@ -238,11 +238,11 @@
]
},
"locked": {
"lastModified": 1763503177,
"narHash": "sha256-VPoiswJBBmTLVuNncvT/8FpFR+sYcAi/LgP/zTZ+5rA=",
"lastModified": 1764592794,
"narHash": "sha256-7CcO+wbTJ1L1NBQHierHzheQGPWwkIQug/w+fhTAVuU=",
"owner": "hyprwm",
"repo": "hyprtoolkit",
"rev": "f4e1e12755567ecf39090203b8f43eace8279630",
"rev": "5cfe0743f0e608e1462972303778d8a0859ee63e",
"type": "github"
},
"original": {
@ -261,11 +261,11 @@
]
},
"locked": {
"lastModified": 1763996058,
"narHash": "sha256-DsqzFZvrEV+aDmavjaD4/bk5qxeZwhGxPWBQdpFyM9Y=",
"lastModified": 1764637132,
"narHash": "sha256-vSyiKCzSY48kA3v39GFu6qgRfigjKCU/9k1KTK475gg=",
"owner": "hyprwm",
"repo": "hyprutils",
"rev": "0168583075baffa083032ed13a8bea8ea12f281a",
"rev": "2f2413801beee37303913fc3c964bbe92252a963",
"type": "github"
},
"original": {
@ -299,11 +299,11 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1763966396,
"narHash": "sha256-6eeL1YPcY1MV3DDStIDIdy/zZCDKgHdkCmsrLJFiZf0=",
"lastModified": 1764517877,
"narHash": "sha256-pp3uT4hHijIC8JUK5MEqeAWmParJrgBVzHLNfJDZxg4=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "5ae3b07d8d6527c42f17c876e404993199144b6a",
"rev": "2d293cbfa5a793b4c50d17c05ef9e385b90edf6c",
"type": "github"
},
"original": {

View file

@ -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>();

View 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;
}

View 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;