Initial commit for build of dwmblocks
This commit is contained in:
commit
e60906dbc6
14 changed files with 416 additions and 0 deletions
62
scripts/bar_bat.sh
Executable file
62
scripts/bar_bat.sh
Executable file
|
@ -0,0 +1,62 @@
|
|||
#!/bin/bash
|
||||
|
||||
#First we get the capacity
|
||||
charge=$(cat /sys/class/power_supply/BAT0/capacity)
|
||||
|
||||
#Now get the status
|
||||
bstat=$(cat /sys/class/power_supply/BAT0/status)
|
||||
|
||||
#Get the symbol for the capacity
|
||||
if [ "$bstat" = "Charging" ]; then
|
||||
cstat=""
|
||||
else
|
||||
cstat=""
|
||||
fi
|
||||
if [ "$charge" -gt 90 ]; then
|
||||
bat="$cstat"
|
||||
elif [ "$charge" -gt 70 ]; then
|
||||
bat="$cstat"
|
||||
elif [ "$charge" -gt 50 ]; then
|
||||
bat="$cstat"
|
||||
elif [ "$charge" -gt 20 ]; then
|
||||
bat="$cstat"
|
||||
else
|
||||
bat=" $cstat"
|
||||
fi
|
||||
|
||||
|
||||
|
||||
|
||||
battery="$bat $charge%"
|
||||
|
||||
if [ -d /sys/class/power_supply/BAT1 ]; then
|
||||
|
||||
#First we get the capacity
|
||||
charge=$(cat /sys/class/power_supply/BAT1/capacity)
|
||||
|
||||
#Now get the status
|
||||
bstat=$(cat /sys/class/power_supply/BAT1/status)
|
||||
if [ "$bstat" = "Charging" ]; then
|
||||
cstat=""
|
||||
else
|
||||
cstat=""
|
||||
fi
|
||||
#Get the symbol for the capacity
|
||||
if [ "$charge" -gt 90 ]; then
|
||||
bat="$cstat"
|
||||
elif [ "$charge" -gt 70 ]; then
|
||||
bat="$cstat"
|
||||
elif [ "$charge" -gt 50 ]; then
|
||||
bat="$cstat"
|
||||
elif [ "$charge" -gt 20 ]; then
|
||||
bat="$cstat"
|
||||
else
|
||||
bat=" $cstat"
|
||||
fi
|
||||
|
||||
echo "$bat $charge% $battery"
|
||||
else
|
||||
echo $battery
|
||||
fi
|
||||
|
||||
|
10
scripts/bar_bit.sh
Executable file
10
scripts/bar_bit.sh
Executable file
|
@ -0,0 +1,10 @@
|
|||
#!/bin/bash
|
||||
#price=$(curl rate.sx/1btc | cut -d '.' -f 1)
|
||||
price=$(coinmon -f BTC | tail -n2 | head -n1 | cut -d ' ' -f 10 | cut -d '.' -f1)
|
||||
|
||||
echo "฿ $price"
|
||||
|
||||
# Check to see if it's a number
|
||||
#re='^[0-9]+$'
|
||||
#if [[ $price =~ $re ]] ; then
|
||||
#fi
|
19
scripts/bar_cpu.sh
Executable file
19
scripts/bar_cpu.sh
Executable file
|
@ -0,0 +1,19 @@
|
|||
#!/bin/bash
|
||||
|
||||
loads=($(mpstat -P ALL 1 1 | awk '/Average:/ && $2 ~ /[0-9]/ {print $3}'))
|
||||
|
||||
warn=''
|
||||
if [ ${loads[0]} -gt 80 ]; then
|
||||
warn=$(echo "1 "$warn)
|
||||
fi
|
||||
if [ ${loads[1]} -gt 80 ]; then
|
||||
warn=$(echo "2 "$warn)
|
||||
fi
|
||||
if [ ${loads[2]} -gt 80 ]; then
|
||||
warn=$(echo "3 "$warn)
|
||||
fi
|
||||
if [ ${loads[3]} -gt 80 ]; then
|
||||
warn=$(echo "4 "$warn)
|
||||
fi
|
||||
avg=$(echo "(${loads[0]}+${loads[1]}+${loads[2]}+${loads[3]})/4" | bc)
|
||||
echo $warn $avg%
|
1
scripts/bar_date.sh
Executable file
1
scripts/bar_date.sh
Executable file
|
@ -0,0 +1 @@
|
|||
echo " $(date '+%b %d (%a) %I:%M%p') "
|
15
scripts/bar_mem.sh
Executable file
15
scripts/bar_mem.sh
Executable file
|
@ -0,0 +1,15 @@
|
|||
#!/bin/bash
|
||||
|
||||
free=$(grep -oP '^MemFree: *\K[0-9]+' /proc/meminfo)
|
||||
available=$(grep -oP '^MemAvailable: *\K[0-9]+' /proc/meminfo)
|
||||
total=$(grep -oP '^MemTotal: *\K[0-9]+' /proc/meminfo)
|
||||
mem=" $(echo "scale=1; 100*($total-$available)/$total"| bc | cut -d '.' -f1 )"
|
||||
|
||||
if [ $mem -gt 80 ]; then
|
||||
mem=" $mem"
|
||||
elif [ $mem -gt 50 ]; then
|
||||
mem="$mem"
|
||||
else
|
||||
mem="$mem"
|
||||
fi
|
||||
echo "$mem%"
|
12
scripts/bar_music.sh
Executable file
12
scripts/bar_music.sh
Executable file
|
@ -0,0 +1,12 @@
|
|||
#!/bin/bash
|
||||
|
||||
#First we get the next appointmen
|
||||
var=$(mpc current);
|
||||
|
||||
if [ "$var" = "" ]; then
|
||||
echo ""
|
||||
else
|
||||
echo " ${var:0:30}"
|
||||
fi
|
||||
|
||||
|
14
scripts/bar_volume.sh
Executable file
14
scripts/bar_volume.sh
Executable file
|
@ -0,0 +1,14 @@
|
|||
#!/usr/bin/bash
|
||||
[ $(pamixer --get-mute) = true ] && echo 婢 && exit
|
||||
|
||||
vol="$(pamixer --get-volume)"
|
||||
|
||||
if [ "$vol" -gt "70" ]; then
|
||||
icon=""
|
||||
elif [ "$vol" -gt "30" ]; then
|
||||
icon=""
|
||||
else
|
||||
icon=""
|
||||
fi
|
||||
|
||||
echo "$icon $vol%"
|
8
scripts/bar_wifi.sh
Executable file
8
scripts/bar_wifi.sh
Executable file
|
@ -0,0 +1,8 @@
|
|||
#!/bin/bash
|
||||
|
||||
case "$(cat /sys/class/net/w*/operstate 2>/dev/null)" in
|
||||
down) echo " ";;
|
||||
up) percentage="$(awk '/^\s*w/ { print int($3 * 100 / 70) "% " }' /proc/net/wireless)"
|
||||
ssid=$(iwgetid -r)
|
||||
echo \ $ssid
|
||||
esac
|
Loading…
Add table
Add a link
Reference in a new issue