aboutsummaryrefslogtreecommitdiff
path: root/dwm/dwm.c
diff options
context:
space:
mode:
Diffstat (limited to 'dwm/dwm.c')
-rwxr-xr-xdwm/dwm.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/dwm/dwm.c b/dwm/dwm.c
index 53b393e..ad5607f 100755
--- a/dwm/dwm.c
+++ b/dwm/dwm.c
@@ -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)
{