core: unlock on sigusr1 (#82)

* Add SIGUSR1 to unlock

* minor style improvements

---------

Co-authored-by: Vaxry <vaxry@vaxry.net>
This commit is contained in:
WindyDay 2024-02-26 01:08:12 +11:00 committed by GitHub
parent 844a899254
commit 146965e7fb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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);
@ -305,6 +312,8 @@ void CHyprlock::run() {
lockSession();
signal(SIGUSR1, handleUnlockSignal);
pollfd pollfds[] = {
{
.fd = wl_display_get_fd(m_sWaylandState.display),