fix: wayland sleep inhibit on client

Fixes #8827
Adds the XWindowsPowerManager to the EiScreen as, despite the name, this
works on Wayland as well.
This commit is contained in:
Louis des Landes 2025-09-12 10:42:24 +09:30 committed by Nick Bolton
parent 56a1bd68dd
commit 7a2591a1fa
2 changed files with 9 additions and 0 deletions

View file

@ -14,6 +14,7 @@
#include "base/Log.h"
#include "base/Stopwatch.h"
#include "common/Constants.h"
#include "deskflow/App.h"
#include "deskflow/Clipboard.h"
#include "deskflow/KeyMap.h"
#include "deskflow/ScreenException.h"
@ -73,6 +74,11 @@ EiScreen::EiScreen(bool isPrimary, IEventQueue *events, bool usePortal, deskflow
throw std::runtime_error("failed to init ei context");
}
}
// disable sleep if the flag is set
if (App::instance().argsBase().m_preventSleep) {
m_powerManager.disableSleep();
}
}
EiScreen::~EiScreen()

View file

@ -9,6 +9,7 @@
#include "deskflow/KeyMap.h"
#include "deskflow/PlatformScreen.h"
#include "platform/XWindowsPowerManager.h"
#include <libei.h>
#include <memory>
@ -188,6 +189,8 @@ private:
using HotKeyMap = std::map<KeyID, HotKeySet>;
HotKeyMap m_hotkeys;
// Despite the name XWindowsPowerManager, this works on Wayland too
XWindowsPowerManager m_powerManager;
};
} // namespace deskflow