Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # status.sh by SkyZ
- # Conky dans la statusbar
- # conky | while read -r; do wmfs -s "$REPLY"; done
- # Statusbar normal
- # Date and Time est juste
- DATE=`date +"%a %e %b"`
- TIME=`date +"%H:%M"`
- ###
- # Moc est juste
- if [ -z $(pidof mocp) ]; then # On vérifie si moc est lancé
- moc="[ Music on Console n'est pas lancé ]"
- else
- songtitle="`mocp -i | grep 'SongTitle:' | sed -e 's/^.*: //'`"
- artist="`mocp -i | grep 'Artist:' | sed -e 's/^.*: //'`"
- currenttime="`mocp -i | grep 'CurrentTime:' | sed -e 's/^.*: //'`"
- totaltime="`mocp -i | grep 'TotalTime:' | sed -e 's/^.*: //'`"
- state="`mocp -i | grep 'State:' | sed -e 's/^.*: //'`"
- filetitle="`mocp -i | grep 'Title:'`"
- if [ -z $filetitle ]; then
- # On vérifie si une piste est en cours d'écoute
- moc="[ Aucune piste en cours d'écoute ]"
- else
- if [ -z $artist ]; then # Si une piste est en cours d'écoute, on vérifie que le titre et le nom de l'artiste sont connus
- artist="Inconnu"
- fi
- if [ -z $songtitle ]; then
- songtitle="Inconnu"
- fi
- if [ "$state" == "PLAY" ]; then # Si une piste est en cours d'écoute, on vérifie si elle est en pause
- playing1="$color Titre : $normal$songtitle"
- playing2="$color Artiste : $normal$artist"
- playing3="$currenttime"
- playing4="$totaltime"
- moc="[ $playing1 $playing2 ($playing3$color/$normal$playing4) ]"
- else
- playing1="$color Titre : $normal$songtitle"
- playing2="$color Artiste : $normal$artist"
- playing3="$currenttime"
- playing4="$totaltime"
- moc="[ $playing1 $playing2 ($playing3$color/$normal$playing4 -$color Pause $normal) ]"
- fi
- fi
- fi
- #}
- if [ $state == PLAY ]
- then
- MOC="$artist - $songtitle"
- else
- MOC=" "
- fi
- ###
- # CPU est juste
- CPU=`eval $(awk '/^cpu /{print "previdle=" $5 "; prevtotal=" $2+$3+$4+$5 }' /proc/stat); sleep 0.4; eval $(awk '/^cpu /{print "idle=" $5 "; total=" $2+$3+$4+$5 }' /proc/stat); intervaltotal=$((total-${prevtotal:-0})); echo "$((100*( (intervaltotal) - ($idle-${previdle:-0}) ) / (intervaltotal) ))%"`
- ###
- # Temperature est juste
- TEMP=`acpi -t | awk 'NR == 1 {print $4}'`;
- ###
- # Volume est juste
- VOL=`amixer | grep "Master" -A 5 | grep -o "\[.*%" | sed "s/\[//"`
- ###
- # Batterie est juste et en cours
- BAT0=`acpi -b | awk '{print $4}'`
- etatbat=`acpi -b | awk '{print $3}'`
- if [ $etatbat = "Discharging," ]; then
- BAT="$BAT0 D"
- elif [ $etatbat = "Charging," ]; then
- BAT="$BAT0 C"
- elif [ $etatbat = "Full," ]; then
- BAT="$BAT0 F"
- else
- BAT="$BAT0"
- fi
- ###
- # Disk usage root
- DUroot=`df -h | awk 'NR == 2 {print $3, $5}'`
- DUhome=`df -h | awk 'NR == 6 {print $3, $5}'`
- ###
- # Memoire utilise
- MEM1=`free -m | awk '/buffers\/cache/{print $3}'`
- MEM2=40 # for 4go, 20 for 2go
- MEM=`echo "$MEM1 / $MEM2" | bc`
- ###
- # Wifi faux
- # WIFI=`cat /sys/class/net/wlan0/wireless/link`
- # \i[1476;2;14;14;/home/stephen/.config/wmfs/icons/time.png]\
- # \i[1229;2;15;15;/home/stephen/.config/wmfs/icons/mpd.png]\
- # `25dw \i[1483;2;14;14;/home/stephen/.config/wmfs/icons/cal.png]\
- # `26dw
- # Afichage
- wmfs -s "Mus. $MOC | Cpu. $CPU | Mem. $MEM% | Temp. $TEMP C | Root. $DUroot | Home. $DUhome | Bat. $BAT | Vol. $VOL | Date. $DATE $TIME "
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement