diff options
Diffstat (limited to 'dwm/dwm.c')
| -rwxr-xr-x | dwm/dwm.c | 16 |
1 files changed, 16 insertions, 0 deletions
@@ -26,6 +26,7 @@ #include <stdarg.h> #include <stdio.h> #include <stdlib.h> +#include <time.h> #include <string.h> #include <unistd.h> #include <sys/types.h> @@ -141,6 +142,7 @@ typedef struct { } Rule; /* function declarations */ +static void spawnlock(const Arg *arg); static void applyrules(Client *c); static int applysizehints(Client *c, int *x, int *y, int *w, int *h, int interact); static void arrange(Monitor *m); @@ -274,6 +276,20 @@ static Window root, wmcheckwin; struct NumTags { char limitexceeded[LENGTH(tags) > 31 ? -1 : 1]; }; /* function implementations */ + +void +spawnlock(const Arg *arg) +{ + static char mode[32]; + size_t n = LENGTH(xlockmodes); + + srand(time(NULL) ^ getpid()); + snprintf(mode, sizeof mode, "%s", xlockmodes[rand() % n]); + + ((char **)lockcmd)[2] = mode; + spawn(&(Arg){ .v = lockcmd }); +} + void applyrules(Client *c) { |
