internal: add lock files and hyprctl instances
This commit is contained in:
parent
ad3b8dddf9
commit
c748f36939
3 changed files with 116 additions and 2 deletions
|
|
@ -312,6 +312,8 @@ void CCompositor::cleanup() {
|
|||
if (!m_sWLDisplay || m_bIsShuttingDown)
|
||||
return;
|
||||
|
||||
removeLockFile();
|
||||
|
||||
m_bIsShuttingDown = true;
|
||||
|
||||
#ifdef USES_SYSTEMD
|
||||
|
|
@ -416,6 +418,23 @@ void CCompositor::initManagers(eManagersInitStage stage) {
|
|||
}
|
||||
}
|
||||
|
||||
void CCompositor::createLockFile() {
|
||||
const auto PATH = "/tmp/hypr/" + m_szInstanceSignature + ".lock";
|
||||
|
||||
std::ofstream ofs(PATH, std::ios::trunc);
|
||||
|
||||
ofs << m_iHyprlandPID << "\n" << m_szWLDisplaySocket << "\n";
|
||||
|
||||
ofs.close();
|
||||
}
|
||||
|
||||
void CCompositor::removeLockFile() {
|
||||
const auto PATH = "/tmp/hypr/" + m_szInstanceSignature + ".lock";
|
||||
|
||||
if (std::filesystem::exists(PATH))
|
||||
std::filesystem::remove(PATH);
|
||||
}
|
||||
|
||||
void CCompositor::startCompositor() {
|
||||
initAllSignals();
|
||||
|
||||
|
|
@ -477,6 +496,8 @@ void CCompositor::startCompositor() {
|
|||
Debug::log(LOG, "systemd integration is baked in but system itself is not booted à la systemd!");
|
||||
#endif
|
||||
|
||||
createLockFile();
|
||||
|
||||
// This blocks until we are done.
|
||||
Debug::log(LOG, "Hyprland is ready, running the event loop!");
|
||||
wl_display_run(m_sWLDisplay);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue