From 611682f48ce45bb7833b292a3cea136800605ec1 Mon Sep 17 00:00:00 2001 From: Pihkaal Date: Wed, 22 Apr 2026 17:13:51 +0200 Subject: [PATCH] feat: use signals to stop instead of xdg_toplevel.close (killactive) --- src/wallpaper.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/wallpaper.c b/src/wallpaper.c index a2fd937..0b2b471 100644 --- a/src/wallpaper.c +++ b/src/wallpaper.c @@ -8,6 +8,14 @@ #include #include #include +#include + +static volatile bool running = true; + +static void handle_signal(int sig) { + (void)sig; + running = false; +} #define WIDTH 1920 #define HEIGHT 1080 @@ -119,6 +127,9 @@ int main(void) { SetTargetFPS(60); SetExitKey(KEY_NULL); + signal(SIGTERM, handle_signal); + signal(SIGINT, handle_signal); + // initialize hyprland socket path hyprland_socket_path = get_hyprland_socket_path(); @@ -153,7 +164,7 @@ int main(void) { int textureUnit = 1; SetShaderValue(shader, distanceFieldTexLoc, &textureUnit, SHADER_UNIFORM_INT); - while (!WindowShouldClose()) { + while (running) { int screenWidth = GetScreenWidth(); int screenHeight = GetScreenHeight();