Skip to content

Commit

Permalink
core: unlock on sigusr1 (#82)
Browse files Browse the repository at this point in the history
* Add SIGUSR1 to unlock

* minor style improvements

---------

Co-authored-by: Vaxry <[email protected]>
  • Loading branch information
singer233 and vaxerski authored Feb 25, 2024
1 parent 844a899 commit 146965e
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/core/hyprlock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,13 @@ void CHyprlock::onGlobalRemoved(void* data, struct wl_registry* registry, uint32

// end wl_registry

static void handleUnlockSignal(int sig) {
if (sig == SIGUSR1) {
Debug::log(LOG, "Unlocking with a SIGUSR1");
g_pHyprlock->unlockSession();
}
}

void CHyprlock::run() {
m_sWaylandState.registry = wl_display_get_registry(m_sWaylandState.display);

Expand All @@ -305,6 +312,8 @@ void CHyprlock::run() {

lockSession();

signal(SIGUSR1, handleUnlockSignal);

pollfd pollfds[] = {
{
.fd = wl_display_get_fd(m_sWaylandState.display),
Expand Down

0 comments on commit 146965e

Please sign in to comment.