custom passwords. sounds.
This commit is contained in:
parent
4e7c29374b
commit
cb044449c6
14
slock.c
14
slock.c
@ -10,6 +10,7 @@
|
||||
#include <pwd.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdlib.h>
|
||||
#define _GNU_SOURCE
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
@ -152,8 +153,19 @@ readpw(Display *dpy, const char *pws)
|
||||
XBell(dpy, 100);
|
||||
if(++lock_tries > 2) {
|
||||
// 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;
|
||||
break;
|
||||
|
21
slocked
Executable file
21
slocked
Executable 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"
|
Loading…
Reference in New Issue
Block a user