From 0d1cc073ed8edf18608545e35152e17a3e9affec Mon Sep 17 00:00:00 2001 From: TheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com> Date: Mon, 20 May 2024 07:31:01 +0900 Subject: Updates dwm keybinding and slock --- slock/slock.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'slock/slock.c') diff --git a/slock/slock.c b/slock/slock.c index 1fc3d9d..957012b 100644 --- a/slock/slock.c +++ b/slock/slock.c @@ -672,7 +672,23 @@ main(int argc, char **argv) { config_init(dpy); /* Load picture */ - Imlib_Image buffer = imlib_load_image(background_image); + char* home_path = getenv("HOME"); + int size_needed = snprintf(NULL, 0, "mount | grep -q ' %s/Personal '", home_path) + 1; + char* command = malloc(size_needed); + snprintf(command, size_needed, "mount | grep -q ' %s/Personal '", home_path); + int result = system(command); + free(command); + if (result != 0) { + background_image = "Pictures/wallpaper/personal-default.png"; + personalblur = 0; + } + size_needed = strlen(home_path) + strlen(background_image) + 2; // +2 for slash and null terminator + char* full_background_image = malloc(size_needed); + strcpy(full_background_image, home_path); + strcat(full_background_image, "/"); + strcat(full_background_image, background_image); + + Imlib_Image buffer = imlib_load_image(full_background_image); if (buffer) { blurRadius = personalblur; -- cgit v1.2.3