core: check if on_(un)lock_cmd is empty

This commit is contained in:
Maximilian Seidler 2025-02-05 18:16:01 +01:00
parent 15ca902b2c
commit 9207836556

View file

@ -351,8 +351,10 @@ void CHypridle::onLocked() {
m_isLocked = true;
static const auto LOCKCMD = g_pConfigManager->getValue<Hyprlang::STRING>("general:on_lock_cmd");
if (*LOCKCMD)
spawn(*LOCKCMD);
if (*LOCKCMD) {
if (const std::string LOCKCMDSTR{*LOCKCMD}; !LOCKCMDSTR.empty())
spawn(LOCKCMDSTR);
}
if (m_inhibitSleepBehavior == SLEEP_INHIBIT_LOCK_NOTIFY)
uninhibitSleep();
@ -366,8 +368,10 @@ void CHypridle::onUnlocked() {
inhibitSleep();
static const auto UNLOCKCMD = g_pConfigManager->getValue<Hyprlang::STRING>("general:on_unlock_cmd");
if (*UNLOCKCMD)
spawn(*UNLOCKCMD);
if (*UNLOCKCMD) {
if (const std::string UNLOCKCMDSTR{*UNLOCKCMD}; !UNLOCKCMDSTR.empty())
spawn(UNLOCKCMDSTR);
}
}
CHypridle::SDbusInhibitCookie CHypridle::getDbusInhibitCookie(uint32_t cookie) {