diff options
author | Mario Preksavec <mario at slackware dot hr> | 2015-03-22 21:32:44 -0500 |
---|---|---|
committer | Willy Sudiarto Raharjo <willysr@slackbuilds.org> | 2015-03-29 07:38:41 +0700 |
commit | 85f5c5f0f3773030c1fd80677e744bd75073617d (patch) | |
tree | 9126675f95f3ff3798c9b293f3c400efc10c484c /desktop/slock | |
parent | f8288ef7f8da5a6a30e1a008745450b97152f73c (diff) |
desktop/slock: Add failcolor diff and optional xflock support
Signed-off-by: Robby Workman <rworkman@slackbuilds.org>
Diffstat (limited to 'desktop/slock')
-rw-r--r-- | desktop/slock/README | 6 | ||||
-rw-r--r-- | desktop/slock/doinst.sh | 3 | ||||
-rw-r--r-- | desktop/slock/slock-1.2-failcolor.diff | 62 | ||||
-rw-r--r-- | desktop/slock/slock.SlackBuild | 13 |
4 files changed, 84 insertions, 0 deletions
diff --git a/desktop/slock/README b/desktop/slock/README index 7170cbcb865a1..6ede76c89ed54 100644 --- a/desktop/slock/README +++ b/desktop/slock/README @@ -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 diff --git a/desktop/slock/doinst.sh b/desktop/slock/doinst.sh new file mode 100644 index 0000000000000..3f9d5d235ccda --- /dev/null +++ b/desktop/slock/doinst.sh @@ -0,0 +1,3 @@ +# Override xflock4 binary +( cd usr/local/bin ; rm -rf xflock4 ) +( cd usr/local/bin ; ln -sf /usr/bin/slock xflock4 ) diff --git a/desktop/slock/slock-1.2-failcolor.diff b/desktop/slock/slock-1.2-failcolor.diff new file mode 100644 index 0000000000000..3b2a03193f338 --- /dev/null +++ b/desktop/slock/slock-1.2-failcolor.diff @@ -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); diff --git a/desktop/slock/slock.SlackBuild b/desktop/slock/slock.SlackBuild index e3e232f5a141c..0b51ea5f6551e 100644 --- a/desktop/slock/slock.SlackBuild +++ b/desktop/slock/slock.SlackBuild @@ -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} |