#!/bin/bash # # xsswatchd 0.1 # simple XScreensaver event executor # (C) Christian Birchinger # CFG_BASEDIR="${HOME}/.xsswatchd" XSS_CMD="/usr/bin/xscreensaver-command" [[ "${DISPLAY}" == '' ]] && export DISPLAY=':0.0' [[ "${XAUTHORITY}" == '' ]] && export XAUTHORITY="~/.Xauthority" mkdir -p "${CFG_BASEDIR}"/{BLANK,UNBLANK,RUN,LOCK}.d ${XSS_CMD} -watch | while read status; do action="${status/ *}" for command in "${CFG_BASEDIR}/${action}".d/* ; do [ -x "${command}" ] && nohup "${command}" >/dev/null 2>&1 & done unset command done unset status