Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # Script to load Dzen with output from 'dzen-mounts.pl' script
- # Written by J. Bobby Lopez <jbl@jbldata.com> - 27 Jan 2010
- #
- # This script utilizes the Dzen notification system
- # Information on Dzen can be found at http://dzen.geekmode.org/
- #DZPATH=`echo -ne "$0" | sed -e 's/\/dzen.*$//'`;
- #echo $DZPATH;
- function mountlines
- {
- LINES=`perl /home/jbl/bin/myscripts/dzen-mounts.pl | wc -l`;
- echo "$LINES"
- }
- function freshmounts
- {
- OUTPUT=`perl /home/jbl/bin/myscripts/dzen-mounts.pl`;
- echo "$OUTPUT"
- }
- function rundzen
- {
- OUTPUT=`freshmounts`;
- MOUNTLINES=`mountlines`;
- echo "$OUTPUT" | dzen2 -p -l "$MOUNTLINES" -u -x 500 -y 0 -w 600 -h 12 -tw 120 -ta l &
- PID=`pgrep -f "dzen2 -p -l $MOUNTLINES -u -x 500 -y 0 -w 600 -h 12 -tw 120 -ta l"`;
- echo "$PID"
- }
- function killdzen
- {
- PID="$1"
- if [ ! "$PID" ]; then
- MOUNTLINES=`mountlines`;
- PID=`pgrep -f "dzen2 -p -l $MOUNTLINES -u -x 500 -y 0 -w 600 -h 12 -tw 120 -ta l"`;
- fi
- if [ "$PID" ]; then
- #echo "Killing $PID.."; # DEBUG STATEMENT
- kill "$PID";
- fi;
- }
- function checkchanges
- {
- while true; do
- NEW=`freshmounts`;
- #echo "$NEW - new"; # DEBUG STATEMENT
- if [ "$OLD" != "$NEW" ]; then
- killdzen "$PID";
- rundzen;
- #echo "$PID started"; # DEBUG STATEMENT
- OLD="$NEW";
- #echo "$OLD - old updated" # DEBUG STATEMENT
- fi
- sleep 1;
- done
- }
- checkchanges
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement