custom passwords. sounds.

This commit is contained in:
Christopher Jeffrey 2014-07-17 14:03:00 -07:00
parent 4e7c29374b
commit cb044449c6
2 changed files with 34 additions and 1 deletions

14
slock.c
View File

@ -10,6 +10,7 @@
#include <pwd.h> #include <pwd.h>
#include <stdarg.h> #include <stdarg.h>
#include <stdlib.h> #include <stdlib.h>
#define _GNU_SOURCE
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <unistd.h> #include <unistd.h>
@ -152,8 +153,19 @@ readpw(Display *dpy, const char *pws)
XBell(dpy, 100); XBell(dpy, 100);
if(++lock_tries > 2) { if(++lock_tries > 2) {
// http://soundbible.com/1819-Police.html // http://soundbible.com/1819-Police.html
system("aplay /home/chjj/police.wav"); char snd[255] = {0};
snprintf(snd, sizeof(snd), "aplay %s/slock/police.wav", getenv("HOME"));
system(snd);
} else {
char snd[255] = {0};
snprintf(snd, sizeof(snd), "aplay %s/slock/beep.wav", getenv("HOME"));
system(snd);
} }
} else {
// http://soundbible.com/1815-A-Tone.html
char snd[255] = {0};
snprintf(snd, sizeof(snd), "aplay %s/slock/beep.wav &", getenv("HOME"));
system(snd);
} }
len = 0; len = 0;
break; break;

21
slocked Executable file
View File

@ -0,0 +1,21 @@
#!/bin/bash
ps=$(ps ux \
| sed 1d \
| grep -v tty1 \
| grep -v pts \
| grep -v '?' \
| awk '{ print $2 }')
if test -n "$ps"; then
echo "Killing: $ps"
kill $ps 2> /dev/null
kill -9 $ps 2> /dev/null
fi
exec 2> /dev/null
pw=$1
if test -z "$pw"; then
pw=$(cat ~/.slock_passwd)
fi
exec slock -p "$pw"