Last active
October 3, 2015 14:38
-
-
Save AlbericC/31ce3e9addeb22a41c78 to your computer and use it in GitHub Desktop.
console outputs on the background !
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env bash | |
# launch a desktop output stuff ! | |
# conky stuff might use some tweaking with some window managers | |
# basically use conky to detect what is the real desktop window on your desktop | |
WINDOW=0x$(conky -i 1 2>&1 | head -n 1 | awk '{print $4}' | sed -e 's/(//' -e 's/)//') | |
ITVAL=5 # update interval (seconds) | |
# prepare some named pipes. (in tmp) | |
# you can push any data through them to make them out | |
mkfifo /tmp/fifo_white /tmp/fifo_yellow /tmp/fifo_red /tmp/fifo_green /tmp/fifo /tmp/fifo_choco | |
# set up display on desktop | |
# top-right, colored streams | |
root-tail -fn -*-fixed-medium-*-normal-*-10-*-*-*-*-*-*-* -i $ITVAL \ | |
-g 480x540+1440+0 -id $WINDOW \ | |
/tmp/fifo_white,Gainsboro,'' \ | |
/tmp/fifo_yellow,Gold,'' \ | |
/tmp/fifo_red,red,'' \ | |
/tmp/fifo_green,chartreuse,'' & | |
#bottom right, white twits | |
root-tail -fn -*-fixed-medium-*-normal-*-10-*-*-*-*-*-*-* -i $ITVAL \ | |
-g 480x510+1440+540 -id $WINDOW \ | |
/tmp/fifo_choco,Chocolate1,'' & | |
# center, main fifo, if need be =) | |
root-tail -fn -*-fixed-medium-*-normal-*-10-*-*-*-*-*-*-* -i $ITVAL \ | |
-g 476x1050+960+0 -id $WINDOW \ | |
/tmp/fifo,grey,'' & | |
# push some data to init the streams | |
# you get to init them with a lil data throught | |
echo '' > /tmp/fifo_white > /tmp/fifo_yellow > /tmp/fifo_red > /tmp/fifo_green > /tmp/fifo | |
# send the uname and date to green as a wecome message : | |
uname -a > /tmp/fifo_green & | |
date > /tmp/fifo_yellow & | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# some uses for the outputs : | |
# feed the auth log to red : | |
tail -f -n 1 /var/log/auth.log > /tmp/fifo_red & | |
# provided you fifos are named /tmp/fifo* this ouputs their name to desktop | |
# it helps remember where to pipe stuff | |
for output in $(ls /tmp/fifo*) ; do echo $output > $output ; done | |
# output clock every so often to a fifo (requires 'at', and creates a lot of jobs in at. funny once or twice though) | |
for mm in {00..23}:{00..59..5} ; do echo 'date > /tmp/fifo_green' | at $mm ; done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env bash | |
# shell script to feed a FIFO | |
# requires the t twitter CLI client https://github.com/sferik/t | |
# not really hard to install | |
while true | |
do | |
# cleanup | |
for i in {1..60} ; do echo " " > /tmp/fifo_choco ; done | |
# first format | |
t timeline -l -n 10 | \ | |
awk '{print $2 " " $3 " " $4 "\t" $5 "\n" substr($0, index($0,$6)) "\n"} ' \ | |
> /tmp/fifo_choco | |
# second format (no date) | |
#t timeline -n 10 > /tmp/fifo_choco | |
# third format (really compact : more tweets but hard to read) | |
# t timeline -l | sed -e 's/\(\@[a-zA-Z_]*\)[ ]*/\1\n/' > /tmp/fifo_choco | |
# wait 5 minutes before updating | |
sleep 300 | |
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
REQUIREMENTS | |
for the console on the desktop itself : | |
-conky (used to detect the real root window) | |
-root-tail (http://freshmeat.net/projects/root-tail) | |
-X server (duh!) | |
install the requirements on any debian based machine with | |
$ sudo aptitude install conky root-tail | |
simply launch as a program (alt-F2) with ./<scrpitname>.sh |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment