diff options
| author | TheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com> | 2024-05-20 07:31:01 +0900 |
|---|---|---|
| committer | TheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com> | 2024-05-20 07:31:01 +0900 |
| commit | 0d1cc073ed8edf18608545e35152e17a3e9affec (patch) | |
| tree | 7f4c09c1a686df4d8d6c46cf9b55d0f0f8ba8944 /slock | |
| parent | e846347b5bc50a79094264f1dcfdbf197be17c0f (diff) | |
Updates dwm keybinding and slock
Diffstat (limited to 'slock')
| -rw-r--r-- | slock/config.h | 5 | ||||
| -rwxr-xr-x | slock/slock | bin | 32144 -> 32144 bytes | |||
| -rw-r--r-- | slock/slock.c | 18 |
3 files changed, 19 insertions, 4 deletions
diff --git a/slock/config.h b/slock/config.h index b71498c..b219101 100644 --- a/slock/config.h +++ b/slock/config.h @@ -1,6 +1,6 @@ /* user and group to drop privileges to */ static const char *group = "wheel"; -static int personalblur = 0; +static int personalblur = 100; static const char *colorname[NUMCOLS] = { [INIT] = "#3c3836", /* after initialization */ @@ -16,7 +16,7 @@ static const char *colorname[NUMCOLS] = { static const int failonclear = 1; /* Background image path, should be available to the user above */ -static const char* background_image = "/home/si/Pictures/wallpaper/personal-yejin-wall.png"; +static const char* background_image = "Personal/photo/DEE96C0C-1003-4749-856A-D369E7E328C5.png"; /* default message */ static const char *message = "THESIAH"; @@ -74,4 +74,3 @@ ResourcePref resources[] = { { "color13", STRING, &colorname[PAM] }, { "color0", STRING, &text_color }, }; - diff --git a/slock/slock b/slock/slock Binary files differindex 5df9120..650ae4d 100755 --- a/slock/slock +++ b/slock/slock 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; |
