Permalink
Browse files

it works!

  • Loading branch information...
1 parent 202e909 commit 6c8cb1036eaf4b1a84489404bbda0242799f1bfa @xiongchiamiov committed Apr 8, 2012
Showing with 26 additions and 10 deletions.
  1. +0 −4 lineify-include.sh
  2. +0 −1 pids/.gitignore
  3. +9 −1 terminal-screensaver
  4. +1 −1 terminal-screensaver-reset
  5. +3 −0 terminal-screensaver.conf.example
  6. +13 −3 terminal-screensaverd
View
@@ -26,7 +26,3 @@ terminal-screensaver-reset
# the scripts will run under their own PIDs.
export terminal_screensaver_pid=$$
-# This will cause a shell exit to give the 'You have running jobs' error
-# message, which requires an `fg` and interrupt before shell exit.
-#terminal-screensaverd &
-
View
@@ -1 +0,0 @@
-*
View
@@ -1,3 +1,11 @@
#!/bin/sh
-echo "screensaver called in process $terminal_screensaver_pid"
+
+function conf() {
+ grep $1 terminal-screensaver.conf.example \
+ | awk '{for (i=2;i<=NF;i++) {printf "%s%s",(i>2?" ":""), $i}; printf "\n"}'
+}
+
+screensaver=`conf screensaver-command`
+echo "screensaver $screensaver called in process $terminal_screensaver_pid"
+exec $screensaver
@@ -1,4 +1,4 @@
#!/bin/sh
-touch pids/$terminal_screensaver_pid
+touch /var/run/terminal-screensaver/$terminal_screensaver_pid
@@ -0,0 +1,3 @@
+idle-minutes-until-start 1
+screensaver-command /usr/local/bin/cmatrix -ab
+
View
@@ -1,10 +1,20 @@
-#!/bin/zsh
+#!/bin/bash
+
+function conf() {
+ grep $1 terminal-screensaver.conf.example \
+ | awk '{for (i=2;i<=NF;i++) {printf "%s%s",(i>2?" ":""), $i}; printf "\n"}'
+}
+
+PID_DIR=/var/run/terminal-screensaver
+mkdir -p $PID_DIR
+chmod a+w $PID_DIR
while :; do
echo "screensaverd called"
- for pid in `ls pids`; do
+ for pid in `ls $PID_DIR`; do
echo "checking $pid"
- if test `find pids/$pid -mmin +1`; then
+ idle=`conf 'idle-minutes-until-start'`
+ if test `find $PID_DIR/$pid -mmin +$idle`; then
echo "too old"
kill -SIGALRM $pid
fi

0 comments on commit 6c8cb10

Please sign in to comment.