diff --git a/README.md b/README.md index af8b404..62c3f4c 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,17 @@ # simple-i3blocks -Simple i3blocks scripts for ram, time and date, storage usage and more to be coded... \ No newline at end of file +Simple i3blocks scripts for ram, time and date, storage usage and more to be coded... + +# TODO +- [x] date and time +- [x] ram +- [x] storage +- [x] ip +- [ ] fix ip not showing sometimes +- [ ] swap +- [ ] audio +- [ ] battery +- [ ] cpu +- [ ] wifi/ethernet/bluetooth +- [ ] external storage mount +- [ ] ethernet bandwith diff --git a/audio b/audio new file mode 100755 index 0000000..c62ed83 --- /dev/null +++ b/audio @@ -0,0 +1,5 @@ +#!/bin/bash +sl=$(amixer get Master | tail -n 1) +status=$(echo "${sl}" | grep -wo "on") +volume=$(echo "${sl}" | awk -F ' ' '{print $5}' | tr -d '[]%') +echo ${volume} diff --git a/config b/config new file mode 100644 index 0000000..f5465cb --- /dev/null +++ b/config @@ -0,0 +1,12 @@ +# general settings +markup=none +separator_block_width=15 +separator=false +command=$HOME/.config/i3blocks/$BLOCK_NAME +interval=5 + +[ram] +[storage] +[ip] +interval=once +[datetime] diff --git a/datetime b/datetime new file mode 100755 index 0000000..fefef98 --- /dev/null +++ b/datetime @@ -0,0 +1,5 @@ +#!/bin/bash +full=$(date '+%A, %_d.%_m. %_H:%M:%S') +short=$(date '+%_H:%M') +echo $full +echo $short diff --git a/ip b/ip new file mode 100755 index 0000000..938ae54 --- /dev/null +++ b/ip @@ -0,0 +1,5 @@ +#!/bin/bash +ip=$(curl ifconfig.me/ip) +echo $ip +echo "" +echo "#04B431" diff --git a/ram b/ram new file mode 100755 index 0000000..afa5915 --- /dev/null +++ b/ram @@ -0,0 +1,14 @@ +#!/bin/bash +gawk ' + /^MemFree:/ { + mfg=$2/1024^2 + mfm=$2/1024 + } END { + if (mfg > 2) { printf("%.1f GB", mfg) } + else { printf( "%.0f MB", mfm ) } + print("\n") + if (mfg > 4) { print("#04B431\n") } + else if (mfg > 2) { print("#FFA500\n") } + else { print("#FF0000\n") } + }' /proc/meminfo + diff --git a/storage b/storage new file mode 100755 index 0000000..6a5ddb0 --- /dev/null +++ b/storage @@ -0,0 +1,16 @@ +#!/bin/bash +df | gawk ' + /\/$/ { + sfg=$4/1024^2 + sfm=$4/1024 + } + END { + if (sfg > 5) { printf("%.1f GB", sfg) } + else { printf( "%.0f MB", sfm ) } + print("\n") + if (sfg > 15) { print("#04B431\n") } + else if (sfg > 5) { print("#FFA500\n") } + else if (sfg > 1) { print("#FF0000\n") } + else { exit 33 } + }' +