mirror of
https://github.com/Ponce/slackbuilds
synced 2024-11-20 19:41:34 +01:00
desktop/slock: Add failcolor diff and optional xflock support
Signed-off-by: Robby Workman <rworkman@slackbuilds.org>
This commit is contained in:
parent
f8288ef7f8
commit
85f5c5f0f3
4 changed files with 84 additions and 0 deletions
|
@ -1 +1,7 @@
|
|||
slock is a simple X display locker.
|
||||
|
||||
Build with FAILCOLOR=yes to support upstream failcolor patch:
|
||||
http://tools.suckless.org/slock/patches/failcolor
|
||||
|
||||
Build with OVERRIDEXFLOCK4=yes to add slock symlink to:
|
||||
/usr/local/bin/xflock4
|
||||
|
|
3
desktop/slock/doinst.sh
Normal file
3
desktop/slock/doinst.sh
Normal file
|
@ -0,0 +1,3 @@
|
|||
# Override xflock4 binary
|
||||
( cd usr/local/bin ; rm -rf xflock4 )
|
||||
( cd usr/local/bin ; ln -sf /usr/bin/slock xflock4 )
|
62
desktop/slock/slock-1.2-failcolor.diff
Normal file
62
desktop/slock/slock-1.2-failcolor.diff
Normal file
|
@ -0,0 +1,62 @@
|
|||
diff --git a/config.def.h b/config.def.h
|
||||
index 89e5977..7f55466 100644
|
||||
--- a/config.def.h
|
||||
+++ b/config.def.h
|
||||
@@ -1,2 +1,3 @@
|
||||
#define COLOR1 "black"
|
||||
#define COLOR2 "#005577"
|
||||
+#define COLOR3 "#550000"
|
||||
diff --git a/slock.c b/slock.c
|
||||
index face75e..8519ce2 100644
|
||||
--- a/slock.c
|
||||
+++ b/slock.c
|
||||
@@ -29,12 +29,13 @@ typedef struct {
|
||||
int screen;
|
||||
Window root, win;
|
||||
Pixmap pmap;
|
||||
- unsigned long colors[2];
|
||||
+ unsigned long colors[3];
|
||||
} Lock;
|
||||
|
||||
static Lock **locks;
|
||||
static int nscreens;
|
||||
static Bool running = True;
|
||||
+static Bool tried = False;
|
||||
|
||||
static void
|
||||
die(const char *errstr, ...) {
|
||||
@@ -135,6 +136,7 @@ readpw(Display *dpy, const char *pws)
|
||||
#ifdef HAVE_BSD_AUTH
|
||||
running = !auth_userokay(getlogin(), NULL, "auth-xlock", passwd);
|
||||
#else
|
||||
+ tried=True;
|
||||
running = !!strcmp(crypt(passwd, pws), pws);
|
||||
#endif
|
||||
if(running)
|
||||
@@ -162,7 +164,7 @@ readpw(Display *dpy, const char *pws)
|
||||
}
|
||||
} else if(llen != 0 && len == 0) {
|
||||
for(screen = 0; screen < nscreens; screen++) {
|
||||
- XSetWindowBackground(dpy, locks[screen]->win, locks[screen]->colors[0]);
|
||||
+ XSetWindowBackground(dpy, locks[screen]->win, locks[screen]->colors[tried ? 2 : 0]);
|
||||
XClearWindow(dpy, locks[screen]->win);
|
||||
}
|
||||
}
|
||||
@@ -179,7 +181,7 @@ unlockscreen(Display *dpy, Lock *lock) {
|
||||
return;
|
||||
|
||||
XUngrabPointer(dpy, CurrentTime);
|
||||
- XFreeColors(dpy, DefaultColormap(dpy, lock->screen), lock->colors, 2, 0);
|
||||
+ XFreeColors(dpy, DefaultColormap(dpy, lock->screen), lock->colors, 3, 0);
|
||||
XFreePixmap(dpy, lock->pmap);
|
||||
XDestroyWindow(dpy, lock->win);
|
||||
|
||||
@@ -212,6 +214,8 @@ lockscreen(Display *dpy, int screen) {
|
||||
lock->win = XCreateWindow(dpy, lock->root, 0, 0, DisplayWidth(dpy, lock->screen), DisplayHeight(dpy, lock->screen),
|
||||
0, DefaultDepth(dpy, lock->screen), CopyFromParent,
|
||||
DefaultVisual(dpy, lock->screen), CWOverrideRedirect | CWBackPixel, &wa);
|
||||
+ XAllocNamedColor(dpy, DefaultColormap(dpy, lock->screen), COLOR3, &color, &dummy);
|
||||
+ lock->colors[2] = color.pixel;
|
||||
XAllocNamedColor(dpy, DefaultColormap(dpy, lock->screen), COLOR2, &color, &dummy);
|
||||
lock->colors[1] = color.pixel;
|
||||
XAllocNamedColor(dpy, DefaultColormap(dpy, lock->screen), COLOR1, &color, &dummy);
|
|
@ -20,6 +20,8 @@
|
|||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
# Modified by Mario Preksavec <mario@slackware.hr>
|
||||
|
||||
PRGNAM=slock
|
||||
VERSION=${VERSION:-1.2}
|
||||
BUILD=${BUILD:-2}
|
||||
|
@ -69,6 +71,12 @@ find -L . \
|
|||
\( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
|
||||
-exec chmod 644 {} \;
|
||||
|
||||
# Support upstream failcolor patch
|
||||
# http://tools.suckless.org/slock/patches/failcolor
|
||||
if [ "${FAILCOLOR:-no}" != "no" ]; then
|
||||
patch -p1 <$CWD/slock-1.2-failcolor.diff
|
||||
fi
|
||||
|
||||
# This uses our CFLAGS defined above
|
||||
sed "s/@SLACKCFLAGS@/$SLKCFLAGS/" $CWD/config.mk.patch | patch -p1
|
||||
|
||||
|
@ -91,5 +99,10 @@ cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
|
|||
mkdir -p $PKG/install
|
||||
cat $CWD/slack-desc > $PKG/install/slack-desc
|
||||
|
||||
# User knows whats at stake
|
||||
if [ "${OVERRIDEXFLOCK4:-no}" != "no" ]; then
|
||||
cat $CWD/doinst.sh > $PKG/install/doinst.sh
|
||||
fi
|
||||
|
||||
cd $PKG
|
||||
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}
|
||||
|
|
Loading…
Reference in a new issue