[SLUG] xscreensaver and a lockfile

From: Eben King (eben1@tampabay.rr.com)
Date: Sat May 20 2006 - 04:28:23 EDT


Hey SLUGgers. I would like to get my machine to make a certain file when
xscreensaver fires up, since I'm not paying attention (or not even there),
and whatever happens, I won't see it until I come back.

In the past, I had xautolock running all the time. It had a "hot" corner
(run xlock now), a "cold" corner (never run xlock), and the rest of the
screen used the default time of 10 minutes.

Now, I use xscreensaver. As it comes, it runs in the background, and after
a time activates. However, it doesn't support "hot" and "cold" corners, so
I went back to running xautolock.

xautolock doesn't fire off xscreensaver directly. It runs a script called
"sslockfile" ("ss"="screen saver"), which looks like this right now
(without the commsented-out stuff and the debugging statements):

#!/bin/bash
unalias -a
lockfile="$HOME/.locked"
xerrorfile=$HOME/.xsession-errors

touch "$lockfile"
/usr/bin/xscreensaver -no-splash &
/usr/bin/xscreensaver-command -activate > /dev/null 2>&1
/usr/bin/xscreensaver-command -watch "$@" 2>&1 \
| while read line ; do
     case $line in
         RUN*)
             echo "Last xscreensaver mode: `echo "$line" | awk '{print $2}'`" ;;
         UNBLANK*)
             /usr/bin/xscreensaver-command -exit
             rm "$lockfile"
             fetchmail | grep -v 'No mail'
             exit
     esac | tail -1 >> "$xerrorfile"
done

The script never exits when I wake up xscreensaver. Here's the end of "set
-x"'s output:

+ case $line in
+ /usr/bin/xscreensaver-command -exit
+ rm /home/eben/.locked
+ fetchmail
+ grep -v 'No mail'
+ tail -1
+ exit
+ read line

Hmm? I though "exit" exited unconditionally.

What I really want is for xscreensaver-command to be killed whenever it
outputs a line beginning with "UNBLANK", and I'll move the stuff in that
part of the case outside the case. I tried using "grep -q", but couldn't
make it work.

Any clues?

-- 
-eben    ebQenW1@EtaRmpTabYayU.rIr.OcoPm    home.tampabay.rr.com/hactar
                   "God does not play dice" -- Einstein
           "Not only does God play dice, he sometimes throws
           them where they can't be seen." -- Stephen Hawking
-----------------------------------------------------------------------
This list is provided as an unmoderated internet service by Networked
Knowledge Systems (NKS).  Views and opinions expressed in messages
posted are those of the author and do not necessarily reflect the
official policy or position of NKS or any of its employees.



This archive was generated by hypermail 2.1.3 : Fri Aug 01 2014 - 19:12:16 EDT