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();