initial commit, simple shell scripts for i3blocks
This commit is contained in:
parent
e8a34b1ef2
commit
2fe68b0e7e
|
@ -0,0 +1,17 @@
|
|||
#!/bin/bash
|
||||
# print out the date for i3blocks
|
||||
|
||||
printmain=$(date '+%a, %d.%m.%Y')
|
||||
printsmall=$(date '+%d.%m.%Y')
|
||||
printcolor="#ffffff"
|
||||
|
||||
case $BLOCK_BUTTON in
|
||||
1) notify-send "today: $(date)" "$(cal -3)" ;;
|
||||
esac
|
||||
|
||||
echo "$printmain"
|
||||
echo "$printsmall"
|
||||
echo "$printcolor"
|
||||
|
||||
##
|
||||
exit 0
|
|
@ -0,0 +1,30 @@
|
|||
#!/bin/bash
|
||||
# run df on root partition for i3blocks
|
||||
|
||||
freemem=$(df -h | grep '/$' | awk '{print $5}' | sed 's/%//g')
|
||||
|
||||
if [[ $freemem -lt 80 ]]; then
|
||||
printmain="$freemem"%
|
||||
printsmall="$freemem"%
|
||||
printcolor="#ffffff"
|
||||
elif [[ $freemem -ge 80 ]] && [[ $freemem -le 90 ]]; then
|
||||
printmain="$freemem"%
|
||||
printsmall="$freemem"%
|
||||
printcolor="#ffff00"
|
||||
elif [[ $freemem -gt 90 ]] && [[ $freemem -le 100 ]]; then
|
||||
printmain="$freemem"%
|
||||
printsmall="$freemem"%
|
||||
printcolor="#ff0000"
|
||||
fi
|
||||
|
||||
case $BLOCK_BUTTON in
|
||||
1) notify-send "$(notify-send "disk free:" \
|
||||
"$(df -h | grep -v tmpfs | grep -v loop | grep -v udev | sort)")" ;;
|
||||
esac
|
||||
|
||||
echo "$printmain"
|
||||
echo "$printmain"
|
||||
echo "$printcolor"
|
||||
|
||||
##
|
||||
exit 0
|
|
@ -0,0 +1,26 @@
|
|||
#!/bin/bash
|
||||
# status bar ip lookup
|
||||
|
||||
# when offline
|
||||
if [[ $(ip a | grep "state" | grep -Ev 'tun|lo' | grep "DOWN ") ]]; then
|
||||
printmain="down"
|
||||
printsmall="down"
|
||||
printcolor="#FF0000"
|
||||
fi
|
||||
|
||||
# when connected
|
||||
if [[ $(ip a | grep "state" | grep -Ev 'tun|lo' | grep "UP ") ]]; then
|
||||
printmain=$(ip -br addr show | grep -v 'lo' \
|
||||
| awk '{print $3}' | awk -F '/' {'print $1}' | tr '\n' ' ')
|
||||
printsmall=$(ip -br addr show | grep -v 'lo' \
|
||||
| awk '{print $3}' | awk -F '/' {'print $1}' | head -n 1)
|
||||
printcolor="#00FF00"
|
||||
fi
|
||||
|
||||
# echo
|
||||
echo "$printmain"
|
||||
echo "$printsmall"
|
||||
echo "$printcolor"
|
||||
|
||||
##
|
||||
exit 0
|
|
@ -0,0 +1,41 @@
|
|||
#!/bin/bash
|
||||
# script for i3block pending updates
|
||||
|
||||
amount=$(wc -l $HOME/Dokumente/status/updates | awk '{print $1}')
|
||||
|
||||
if [[ $amount -eq 0 ]]; then
|
||||
printmain=""
|
||||
printsmall=""
|
||||
printcolor=""
|
||||
fi
|
||||
|
||||
if [[ $amount -gt 0 ]] && [[ $amount -le 30 ]]; then
|
||||
printmain=" $amount"
|
||||
printsmall=""
|
||||
printcolor="#FFFFFF"
|
||||
fi
|
||||
|
||||
if [[ $amount -gt 30 ]] && [[ $amount -le 100 ]]; then
|
||||
printmain=" $amount"
|
||||
printsmall=""
|
||||
printcolor="#FFFF00"
|
||||
fi
|
||||
|
||||
if [[ $amount -gt 100 ]]; then
|
||||
printmain=" $amount"
|
||||
printsmall=""
|
||||
printcolor="#FF0000"
|
||||
fi
|
||||
|
||||
case $BLOCK_BUTTON in
|
||||
1) notify-send "pending updates:" "$(cat ~/Dokumente/status/updates)" ;;
|
||||
3) notify-send "looking for updates..." && notify-send \
|
||||
"$($HOME/sync/system/arch/script/checkupd.sh)" ;;
|
||||
esac
|
||||
|
||||
echo "$printmain"
|
||||
echo "$printsmall"
|
||||
echo "$printcolor"
|
||||
|
||||
##
|
||||
exit 0
|
|
@ -0,0 +1,39 @@
|
|||
#!/bin/bash
|
||||
# get wifi info for i3blocks
|
||||
|
||||
# get interface
|
||||
interface=$(ip link show up | grep -vi 'loopback' \
|
||||
| head -n 1 | awk '{print $2}' | sed 's/://g')
|
||||
|
||||
# read db value for interface
|
||||
db=$(cat /proc/net/wireless | grep "$interface" \
|
||||
| awk -F '. ' '{print $3}')
|
||||
if [[ -n "$db" ]]; then
|
||||
printmain="$db db"
|
||||
printsmall="$db db"
|
||||
else
|
||||
printmain=""
|
||||
printsmall=""
|
||||
fi
|
||||
|
||||
# switch color
|
||||
if [[ $db -le 60 ]]; then
|
||||
printcolor="#00FF00"
|
||||
elif [[ $db -le 80 ]] && [[ $db -gt 60 ]]; then
|
||||
printcolor="#FFFF00"
|
||||
else
|
||||
printcolor="#FF0000"
|
||||
fi
|
||||
|
||||
# sent nmcli status on click
|
||||
case $BLOCK_BUTTON in
|
||||
1) notify-send "$(nmcli device status)";;
|
||||
esac
|
||||
|
||||
# echo three lines
|
||||
echo "$printmain"
|
||||
echo "$printsmall"
|
||||
echo "$printcolor"
|
||||
|
||||
##
|
||||
exit 0
|
Loading…
Reference in New Issue