2019-05-25 13:54:12 +02:00
|
|
|
#!/bin/bash
|
2019-05-27 21:54:21 +02:00
|
|
|
testweather() {
|
|
|
|
[ "$(stat -c %y "/tmp/weatherreport" 2>/dev/null | cut -d' ' -f1)" != "$(date '+%Y-%m-%d')" ] && ping -q -c 1 1.1.1.1 >/dev/null && curl -s "wttr.in/$location" > "/tmp/weatherreport" && notify-send "🌞 Weather" "New weather forecast for today."
|
|
|
|
|
|
|
|
printf "%s" "$(sed '16q;d' "/tmp/weatherreport" | grep -wo "[0-9]*%" | sort -n | sed -e '$!d' | sed -e "s/^/☔ /g" | tr -d '\n')" && sed '13q;d' "/tmp/weatherreport" | grep -o "m\\(-\\)*[0-9]\\+" | sort -n -t 'm' -k 2n | sed -e 1b -e '$!d' | tr '\n|m' ' ' | awk '{print " ❄️",$1 "°","🌞",$2 "°"}'
|
2019-05-25 13:54:12 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
print_volume() {
|
|
|
|
[ "$(pulsemixer --get-mute)" = "1" ] && printf "" && exit
|
|
|
|
vol=$(pulsemixer --get-volume | awk '{print $1}')
|
|
|
|
printf "%s%%\\n" " $vol"
|
|
|
|
}
|
|
|
|
|
|
|
|
print_wifi()
|
|
|
|
{
|
|
|
|
# ESSID="`iw dev wlan0 link | grep SSID| sed -r 's/SSID://' | sed -e 's/^[ \t]*//'`"
|
|
|
|
# if test -z "$ESSID"
|
|
|
|
# then
|
|
|
|
# echo -e ""
|
|
|
|
# else
|
|
|
|
# echo -e " $ESSID"
|
|
|
|
# fi
|
|
|
|
|
|
|
|
[ "$(cat /sys/class/net/w*/operstate)" = 'down' ] && wifiicon="📡"
|
|
|
|
|
|
|
|
[ ! -n "${wifiicon+var}" ] && wifiicon=$(grep "^\s*w" /proc/net/wireless | awk '{ print "", int($3 * 100 / 70) "%" }')
|
|
|
|
|
|
|
|
printf "%s %s" "$wifiicon" "$(cat /sys/class/net/e*/operstate | sed "s/down//;s/up//")"
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
print_temp(){
|
|
|
|
echo -e " $(sensors | awk '/Core 0/ {print $3}') +$(nvidia-smi -q -d temperature | grep -i "GPU Current" |sed -r 's/GPU Current Temp ://'| sed -r 's/ C//' |sed -e 's/^[ \t]*//').0°C"
|
|
|
|
}
|
|
|
|
|
|
|
|
print_date(){
|
2019-06-01 12:41:06 +02:00
|
|
|
echo -e " $(date +"%m-%d %H:%M")"
|
2019-05-25 13:54:12 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
print_mail(){
|
|
|
|
RESULT=$(echo "$(du -a ~/.mailbox/*/inbox/new/* 2>/dev/null | sed -n '$=')$(cat /tmp/imapsyncicon_$USER 2>/dev/null)")
|
|
|
|
if [ -z $RESULT ]; then
|
|
|
|
echo "0"
|
|
|
|
else
|
|
|
|
echo "$(du -a ~/.mailbox/*/inbox/new/* 2>/dev/null | sed -n '$=')$(cat /tmp/imapsyncicon_$USER 2>/dev/null)"
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
batLevel() {
|
|
|
|
# Find the battery level
|
|
|
|
hash acpi || return 0
|
|
|
|
onl="$(acpi -V | grep "on-line")"
|
|
|
|
charge="$(cat /sys/class/power_supply/BAT*/capacity)"
|
|
|
|
|
|
|
|
# Determine battery glyph by percentage range
|
|
|
|
if [[ -z $onl && ${charge} -gt 80 ]]; then
|
|
|
|
echo -e " ${charge}%"
|
|
|
|
elif [[ -z $onl && ${charge} -le 80 && ${charge} -gt 60 ]]; then
|
|
|
|
echo -e " ${charge}%"
|
|
|
|
elif [[ -z $onl && ${charge} -le 60 && ${charge} -gt 40 ]]; then
|
|
|
|
echo -e " ${charge}%"
|
|
|
|
elif [[ -z $onl && ${charge} -le 40 && ${charge} -gt 20 ]]; then
|
|
|
|
echo -e " ${charge}%"
|
|
|
|
elif [[ -z $onl && ${charge} -le 20 ]]; then
|
|
|
|
echo -e " ${charge}%"
|
|
|
|
# If charging, use animated glyph
|
|
|
|
else
|
|
|
|
echo -e ""
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
usageData() {
|
|
|
|
# Calculate CPU percentage
|
|
|
|
read cpu a b c pi rest < /proc/stat
|
|
|
|
pt=$((a+b+c+pi))
|
|
|
|
sleep 0.1
|
|
|
|
read cpu a b c i rest < /proc/stat
|
|
|
|
t=$((a+b+c+i))
|
|
|
|
cpuUse=$((100*( (t-pt) - (i-pi) ) / (t-pt) ))
|
|
|
|
|
|
|
|
# Find RAM use
|
|
|
|
# As "A/B"
|
|
|
|
ramUseA=$(free -m -h | grep Mem | awk '{print $3"/"$2}')
|
|
|
|
# As percentage
|
|
|
|
ramPer=$(free -m | grep Mem | awk '{print 100*($3/$2)}')
|
|
|
|
ramUseB="${ramPer%.*}"
|
|
|
|
|
|
|
|
echo -e " $cpuUse% $ramUseB%"
|
|
|
|
}
|
|
|
|
|
2019-06-01 12:41:06 +02:00
|
|
|
|
|
|
|
playerCmus(){
|
2019-06-01 13:39:07 +02:00
|
|
|
cmus=$(cmus-remote -Q | grep status)
|
|
|
|
case "$cmus" in
|
|
|
|
"status stop"*)
|
|
|
|
echo ""
|
|
|
|
;;
|
|
|
|
"status paused"*)
|
|
|
|
echo "| |"
|
|
|
|
;;
|
|
|
|
'status playing'*)
|
|
|
|
echo "| |"
|
|
|
|
;;
|
|
|
|
"")
|
|
|
|
echo ""
|
|
|
|
;;
|
|
|
|
esac
|
2019-06-01 12:41:06 +02:00
|
|
|
}
|
|
|
|
|
2019-05-25 13:54:12 +02:00
|
|
|
echo AUTOSTART
|
|
|
|
feh --bg-fill $HOME/.wall.jpg &
|
|
|
|
xset s off -dpms&
|
|
|
|
xset b off&
|
|
|
|
xset s off&
|
|
|
|
xset -dpms&
|
|
|
|
redshift -l 52.2327:18.3036 -t 6500:3200&
|
|
|
|
nm-applet --sm-disable&
|
|
|
|
/usr/local/bin/st -e "tmux-my"&
|
|
|
|
"/mnt/mega/Systems/Gentoo/apps/KeePass.AppImage"&
|
|
|
|
megasync&
|
|
|
|
dunst -config&
|
|
|
|
/usr/bin/ibus-daemon -d&
|
|
|
|
sh /home/yorune/.xsessionrc&
|
|
|
|
keepassxc&
|
|
|
|
transmission-daemon&
|
|
|
|
teamviewer&
|
2019-05-27 21:54:21 +02:00
|
|
|
getforecast&
|
2019-05-25 13:54:12 +02:00
|
|
|
|
|
|
|
while true
|
|
|
|
do
|
2019-06-01 13:39:07 +02:00
|
|
|
xsetroot -name "$(playerCmus) $(print_temp) | $(usageData) | $(testweather) | $(print_wifi) | $(batLevel) | $(print_volume) | $(print_date)"
|
2019-05-25 13:54:12 +02:00
|
|
|
sleep 2
|
|
|
|
|
|
|
|
done
|
|
|
|
|