Skip to content

Commit de1be8d

Browse files
add lockDenied event to the backend
Lock screens need to know when to exit without an unlock.
1 parent 0b06f6e commit de1be8d

File tree

3 files changed

+10
-0
lines changed

3 files changed

+10
-0
lines changed

include/hyprtoolkit/core/Backend.hpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,11 @@ namespace Hyprtoolkit {
8787
Get notified when a new output was added.
8888
*/
8989
Hyprutils::Signal::CSignalT<Hyprutils::Memory::CSharedPointer<IOutput>> outputAdded;
90+
91+
/*
92+
Sent when the compositor denies us as the exclusive lock screen client.
93+
*/
94+
Hyprutils::Signal::CSignalT<> lockDenied;
9095
} m_events;
9196

9297
HT_HIDDEN : CBackend();

src/core/platforms/WaylandPlatform.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -655,6 +655,8 @@ SP<CCExtSessionLockV1> CWaylandPlatform::aquireSessionLock() {
655655

656656
m_waylandState.sessionLockState.lock->setFinished([this](CCExtSessionLockV1* r) {
657657
g_logger->log(HT_LOG_ERROR, "We got denied by the compositor to be the exclusive lock screen client. Is there another lock screen active?");
658+
g_backend->m_events.lockDenied.emit();
659+
658660
for (const auto& w : m_lockSurfaces) {
659661
if (w.expired())
660662
continue;

tests/SimpleSessionLock.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,9 @@ int main(int argc, char** argv, char** envp) {
121121
}
122122

123123
backend->m_events.outputAdded.listenStatic(createLockSurface);
124+
backend->m_events.lockDenied.listenStatic([]{
125+
std::println("Lock denied!");
126+
});
124127

125128
for (const auto& o: backend->getOutputs()) {
126129
createLockSurface(o);

0 commit comments

Comments
 (0)