Added more dwm-scrips as well as screenshot script making use of maim

This commit is contained in:
_N0x 2021-01-29 01:09:38 +01:00
parent d586229326
commit c167d62f5a
8 changed files with 57 additions and 11 deletions

View File

@ -1,6 +0,0 @@
#!/bin/sh
# get battery percentage and current time remaining
#acpi | awk -F '[, :]' '{print $6 " ~" $8":"$9}'
acpi | awk -F '[, :]' '{ print $6 }'

7
localbin/.local/bin/dwmbattery Executable file
View File

@ -0,0 +1,7 @@
#!/bin/bash
icon=""
#battery="$(acpi | awk -F '[, :]' '{ print $6 " ~" $8":"$9 }')" # with time remaning
battery="$(acpi | awk -F '[, :]' '{ print $6 }')" # without time
printf " %s %s \\n" "$icon" "$battery"

11
localbin/.local/bin/dwmcpu Executable file
View File

@ -0,0 +1,11 @@
#!/bin/bash
read cpu a b c previdle rest < /proc/stat
prevtotal=$((a+b+c+previdle))
sleep 0.5
read cpu a b c idle rest < /proc/stat
total=$((a+b+c+idle))
cpu=$((100*( (total-prevtotal) - (idle-previdle) ) / (total-prevtotal) ))
icon=""
printf " %s %s \\n" "$icon" "$cpu%"

8
localbin/.local/bin/dwmdisk Executable file
View File

@ -0,0 +1,8 @@
#!/bin/bash
icon=""
hdd1="$(df / | awk '/^\// { print $5 }')"
hdd2="$(df /home | awk '/^\// { print $5 }')"
printf " %s / %s | %s /home %s \\n" "$icon" "$hdd1" "$icon" "$hdd2"

7
localbin/.local/bin/dwmmemory Executable file
View File

@ -0,0 +1,7 @@
#!/bin/bash
icon=""
mem="$(free -h | awk '/^Mem/ { print $3"/"$2 }' | sed s/i//g)"
printf " %s %s \\n" "$icon" "$mem"

21
localbin/.local/bin/dwmnetwork Executable file
View File

@ -0,0 +1,21 @@
#!/bin/bash
icon=""
iface="enp4s0"
up=""
down=""
R1="$(cat /sys/class/net/$iface/statistics/rx_bytes)"
T1="$(cat /sys/class/net/$iface/statistics/tx_bytes)"
sleep 1
R2="$(cat /sys/class/net/$iface/statistics/rx_bytes)"
T2="$(cat /sys/class/net/$iface/statistics/tx_bytes)"
TBPS="$(expr $T2 - $T1)"
RBPS="$(expr $R2 - $R1)"
TKBPS="$(expr $TBPS / 1024)"
RKBPS="$(expr $RBPS / 1024)"
IPADDR="$(ip a show dev $iface | awk '/inet / { print $2 } ')"
printf " %s [%s] %s %skB/s %s %skB/s \\n" "$icon" "$IPADDR" "$up" "$TKBPS" "$down" "$RKBPS"
#echo "tx $iface: $TKBPS kB/s rx $iface: $RKBPS kB/s"

View File

@ -1,5 +0,0 @@
#!/bin/sh
# simple script to show systemmemory in dwmblocks
free -h | awk '/^Mem/ { print $3"/"$2 }' | sed s/i//g

View File

@ -0,0 +1,3 @@
#!/bin/bash
/usr/bin/maim -s ~/Pictures/Screenshot_$(date +%Y%m%d_%H:%M:%S).jpg