Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- print_trans(){
- if (( `transmission-remote -l | grep 'Idle\|Up & Down\|Uploading\|Downloading\|Seeding' | wc -l` > 0 )); then
- echo -ne "\x01[\x02torrent:\x06!on\x01]"
- fi
- }
- print_key(){
- if [[ `xset -q | grep "Num Lock" | awk {'print $8'}` == off ]]; then
- echo -ne "\x01[\x02num_lock:\x05!off\x01]"
- fi
- if [[ `xset -q | grep "Caps Lock" | awk {'print $4'}` == on ]]; then
- echo -ne "\x01[\x02caps_lock:\x05!on\x01]"
- fi
- }
- print_cmus(){
- artist (){
- _artist=`cmus-remote -Q | grep " artist " | cut -c 12- | sed 's/ /_/g' | cut -c -25`
- if [[ -z `echo $_artist` ]]; then
- echo "Unknow"
- else
- echo "$_artist"
- fi
- }
- title (){
- _title=`cmus-remote -Q | grep title | cut -c 11- | sed 's/ /_/g' | cut -c -25`
- if [[ -z `echo $_title` ]]; then
- echo "Unknow"
- else
- echo "$_title"
- fi
- }
- if [[ `cmus-remote -Q | grep status | cut -c 8-` == "playing" ]]; then
- echo -ne "\x01[\x02play:\x06`artist`\x02-\x06`title`\x01]"
- fi
- }
- print_im(){
- if [ -f /home/admin/.mcabber/mcabber.state ]; then
- if [ -n "`cat /home/admin/.mcabber/mcabber.state | grep "@mrim.jabber.ru"`" ]; then
- echo -ne "\x01[\x02im:\x06!message\x01]"
- fi
- fi
- }
- print_temp(){
- _temp=`cat /sys/class/thermal/thermal_zone0/temp | cut -c -2`
- if (( $_temp >= 75 )); then
- echo -ne "\x01[\x02warning:\x05!$_temp°\x01]";
- fi
- }
- print_net(){
- if [[ `cat /sys/class/net/enp2s0f0/operstate` == up ]]; then
- _ip_enp=`ip addr show dev enp2s0f0 | grep 'inet ' | awk '{print $2}' | grep -o '^[^/]*'`
- if [[ -n $_ip_enp ]]; then
- echo -ne "\x01enp2s0f0:\x02$_ip_enp"
- fi
- fi
- if [[ `cat /sys/class/net/wlp3s0/operstate` == up ]]; then
- _ip_wlp=`ip addr show dev wlp3s0 | grep 'inet ' | awk '{print $2}' | grep -o '^[^/]*'`
- if [[ -n $_ip_wlp ]]; then
- echo -ne "\x01wlp3s0:\x02$_ip_wlp"
- fi
- fi
- #if ping -c 3 icanhazip.com > /dev/null
- # then echo -ne "\x01:\x02`wget -O - -t 60 -q icanhazip.com`"
- #fi
- }
- print_bri(){
- _bri=$(echo `cat /sys/class/backlight/intel_backlight/brightness`/9.76 | bc)
- if (( $_bri <= "95" )); then
- echo -ne "\x01bri:\x02$_bri";
- fi;
- }
- print_vol(){
- _vol=`amixer get Master | grep 'Mono:' | awk '{print $4}' | sed s/[^0-9]//g`
- if (( $_vol != 100 )); then
- echo -ne "\x01vol:\x02$_vol"
- fi
- }
- print_bat(){
- BAT=($`cat /sys/class/power_supply/BAT0/uevent | sed "s/POWER.*=//"`)
- if [ ${BAT[1]} == "Discharging" ]; then
- if (( ${BAT[11]} > 75 )); then
- echo -ne "\x01[\x02bat:\x02${BAT[11]}\x01]"
- elif (( ${BAT[11]} >= 50 )); then
- echo -ne "\x01[\x02bat:\x06${BAT[11]}\x01]"
- elif (( ${BAT[11]} >= 25 )); then
- echo -ne "\x01[\x02bat:\x10${BAT[11]}\x01]"
- elif (( ${BAT[11]} < 25 )); then
- echo -ne "\x01[\x02bat:\x05!${BAT[11]}\x01]"
- fi
- else
- if (( ${BAT[11]} != 100 )); then
- echo -ne "\x01[\x02bat: charging\x01]"
- fi
- fi
- }
- print_date(){
- #echo -ne "\x01[\x02`date +%a.%d.%m`\x01]"
- echo -ne "\x01[\x02`date +%H:%M`\x01]"
- }
- print_lang(){
- echo -ne "\x02`skb -1`"
- }
- while true; do
- xsetroot -name "$(print_trans)$(print_key)$(print_cmus)$(print_im)$(print_temp)$(print_net)$(print_bri)$(print_vol)$(print_bat)$(print_date)$(print_lang)"
- sleep 1
- done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement