dwm/dwm_status

167 lines
5.0 KiB
Plaintext
Raw Normal View History

2019-05-25 13:54:12 +02:00
#!/bin/bash
2020-02-02 17:27:13 +01:00
#
2020-02-03 14:32:36 +01:00
# Last update: 02-02-2020
2020-02-02 17:27:13 +01:00
#
2019-09-04 20:21:44 +02:00
xset s off -dpms&
xset b off&
xset s off&
xset -dpms&
2020-02-03 14:32:36 +01:00
compton&
feh --bg-fill $HOME/.wall.jpg &
2019-09-04 20:21:44 +02:00
redshift -l 52.2327:18.3036 -t 6500:3200&
nm-applet --sm-disable&
2020-03-05 22:31:52 +01:00
#/usr/local/bin/st -e /bin/sh -c "tmux new-session -s BASE -n HOME '/bin/zsh'\; split-window -h \; split-window 'htop'\; new-window -n IRC 'irssi'\; new-window -n MUSIC 'cmus'"&
/usr/local/bin/st -e /bin/sh -c "tmux new-session -s BASE -n HOME '/bin/zsh'\; split-window -h \; split-window 'htop'\; new-window -n MUSIC 'cmus'"&
#firefox&
export QT_SCALE_FACTOR=1; qutebrowser&
2020-02-02 17:27:13 +01:00
thunderbird-bin&
sudo keepassxc&
#megasync&
2019-09-04 20:21:44 +02:00
dunst -config&
2019-10-05 23:18:46 +02:00
/usr/bin/ibus-daemon -d&
2019-09-04 20:21:44 +02:00
transmission-daemon&
2020-02-02 17:27:13 +01:00
#teamviewer&
2019-10-05 23:18:46 +02:00
#pl&
2020-02-02 17:27:13 +01:00
(sleep 30 && getforecast)&
sudo /usr/bin/rdate -s -l ntp.task.gda.pl && sudo /sbin/hwclock --systohc
/opt/MEGAcmd/mega-cmd-server --debug-full > /var/log/megacmd/megacmd.log&
2019-09-22 00:26:12 +02:00
print_torrent(){
transmission-remote -l | grep % |
sed " # This first sed command is to ensure a desirable order with sort
s/.*Stopped.*/A/g;
s/.*Seeding.*/Z/g;
s/.*100%.*/N/g;
s/.*Idle.*/B/g;
s/.*Uploading.*/L/g;
s/.*%.*/M/g" |
sort -h | uniq -c | sed " # Now we replace the standin letters with icons.
s/A//g;
s/B//g;
s/L//g;
s/M//g;
s/N//g;
s/Z//g" | awk '{print $2, $1}' | sed -e "s/ $//g"
}
2019-05-27 21:54:21 +02:00
testweather() {
2020-03-05 22:31:52 +01:00
[ "$(stat -c %y "/home/yorune/.weatherreport" 2>/dev/null | cut -d' ' -f1)" != "$(date '+%Y-%m-%d')" ] && curl -s "wttr.in/$location" > "/home/yorune/.weatherreport"
2019-09-11 14:04:24 +02:00
2020-02-02 17:27:13 +01:00
printf "%s " "$(sed '16q;d' "/home/yorune/.weatherreport" | grep -wo "[0-9]*%" | sort -n | sed -e '$!d' | sed -e "s/^/ /g" | tr -d '\n')" && sed '13q;d' "/home/yorune/.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()
{
2019-11-29 21:31:52 +01:00
[ "$(cat /sys/class/net/w*/operstate)" = 'down' ] && wifiicon=""
2019-05-25 13:54:12 +02:00
[ ! -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(){
2019-09-21 23:23:59 +02:00
echo -e " $(sensors | awk '/Core 0/ {print $3}') +$(sudo 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"
2019-05-25 13:54:12 +02:00
}
print_date(){
2019-09-11 14:04:24 +02:00
echo -e " $(date +"%d/%m %H:%M")"
2019-05-25 13:54:12 +02:00
}
2020-03-05 22:31:52 +01:00
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)"
2019-10-23 21:07:02 +02:00
time="$(awk '{print $5}' <(acpi))"
2019-05-25 13:54:12 +02:00
# Determine battery glyph by percentage range
if [[ -z $onl && ${charge} -gt 80 ]]; then
2019-10-23 21:07:02 +02:00
echo -e " ${charge}% ${time}"
2019-05-25 13:54:12 +02:00
elif [[ -z $onl && ${charge} -le 80 && ${charge} -gt 60 ]]; then
2019-10-23 21:07:02 +02:00
echo -e " ${charge}% ${time}"
2019-05-25 13:54:12 +02:00
elif [[ -z $onl && ${charge} -le 60 && ${charge} -gt 40 ]]; then
2019-10-23 21:07:02 +02:00
echo -e " ${charge}% ${time}"
2019-05-25 13:54:12 +02:00
elif [[ -z $onl && ${charge} -le 40 && ${charge} -gt 20 ]]; then
2019-10-23 21:07:02 +02:00
echo -e " ${charge}% ${time}"
2019-05-25 13:54:12 +02:00
elif [[ -z $onl && ${charge} -le 20 ]]; then
2019-10-23 21:07:02 +02:00
echo -e " ${charge}% ${time}"
2019-05-25 13:54:12 +02:00
# If charging, use animated glyph
else
echo -e ""
fi
}
usageData() {
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) ))
ramUseA=$(free -m -h | grep Mem | awk '{print $3"/"$2}')
ramPer=$(free -m | grep Mem | awk '{print 100*($3/$2)}')
ramUseB="${ramPer%.*}"
echo -e " $cpuUse%  $ramUseB%"
}
playerCmus(){
cmus=$(cmus-remote -Q | grep status)
case "$cmus" in
"status stop"*)
echo ""
;;
"status paused"*)
2019-10-05 23:18:46 +02:00
echo ""
;;
'status playing'*)
2019-10-05 23:18:46 +02:00
INFO_CMUS=$(cmus-remote -Q 2>/dev/null)
if [[ $? -eq 0 ]]; then
INFO_TITLE=$(echo "${INFO_CMUS}" | sed -n -e 's/^.*title//p' | head -n 1)
INFO_ALBUM=$(echo "${INFO_CMUS}" | sed -n -e 's/^.*album//p' | head -n 1)
INFO_ARTIST=$(echo "${INFO_CMUS}" | sed -n -e 's/^.*artist//p' | head -n 1)
else
exit
fi
if [[ "${INFO_ARTIST}" ]] && [[ "${INFO_TITLE}" ]]; then
OUT_TEXT="${INFO_ARTIST} -${INFO_TITLE}"
elif [[ "${INFO_TITLE}" ]]; then
OUT_TEXT="${INFO_TITLE}"
fi
echo -e ""
#echo -e "${OUT_TEXT}"
;;
"")
echo ""
;;
esac
}
2019-10-05 23:18:46 +02:00
2019-05-25 13:54:12 +02:00
while true
do
2020-02-02 17:27:13 +01:00
xsetroot -name "$(print_temp) | $(usageData) | $(print_wifi) | $(testweather) | $(batLevel) | $(print_volume) | $(print_date)"
#xsetroot -name "$(print_wifi) | $(batLevel) | $(print_volume) | $(print_date)"
2019-09-11 14:04:24 +02:00
sleep 2
2019-05-25 13:54:12 +02:00
done