diff options
author | Archie Hilton <archie.hilton1@gmail.com> | 2019-10-25 12:43:29 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-10-25 12:43:29 +0100 |
commit | 7cecb2d92b9aa2aa981dd9b2847f3624189f93e8 (patch) | |
tree | 73ddc9698c52f85c4665287fd352ac74fa770357 /modules | |
parent | 570963e08c2b95b2ba0ba97dfed401dd0f06a4e3 (diff) | |
parent | fe7633cd1b14275540dfba051b67c6bcef03ecc7 (diff) |
Merge pull request #3 from thytom/parallel
Parallel stuff + New modules
Diffstat (limited to 'modules')
-rwxr-xr-x | modules/archupdates | 4 | ||||
-rwxr-xr-x | modules/fanspeed | 13 | ||||
-rwxr-xr-x | modules/internet | bin | 177 -> 16536 bytes | |||
-rwxr-xr-x | modules/kernel | 12 | ||||
-rwxr-xr-x | modules/localip | 12 | ||||
-rwxr-xr-x | modules/networkdowntraffic | 31 | ||||
-rwxr-xr-x | modules/networkuptraffic | 32 | ||||
-rwxr-xr-x | modules/publicip | 13 | ||||
-rw-r--r-- | modules/src/internet.c | 10 | ||||
-rwxr-xr-x | modules/voidupdates | 16 |
10 files changed, 141 insertions, 2 deletions
diff --git a/modules/archupdates b/modules/archupdates index ea44e2e..ad8b405 100755 --- a/modules/archupdates +++ b/modules/archupdates @@ -4,7 +4,7 @@ # Requires an internet connection # Depends on yay and checkupdates (pacman-contrib) -PREFIX=' Updates:' +PREFIX=' Updates: ' get_updates() { @@ -18,7 +18,7 @@ get_updates() updates=$(("$updates_arch" + "$updates_aur")) - echo "$PREFIX $updates" + echo "$PREFIX$updates" } get_updates diff --git a/modules/fanspeed b/modules/fanspeed new file mode 100755 index 0000000..16af999 --- /dev/null +++ b/modules/fanspeed @@ -0,0 +1,13 @@ +#!/bin/bash + +# Prints the fan RPM +# Depends on lm_sensors + +PREFIX=' ' + +get_fan_speed() +{ + echo "$PREFIX$(sensors | grep fan1 | cut -d " " -f 9) RPM" +} + +get_fan_speed diff --git a/modules/internet b/modules/internet Binary files differindex 7c06858..6fe6aec 100755 --- a/modules/internet +++ b/modules/internet diff --git a/modules/kernel b/modules/kernel new file mode 100755 index 0000000..1ee3939 --- /dev/null +++ b/modules/kernel @@ -0,0 +1,12 @@ +#!/bin/bash + +# Prints out the kernel version + +PREFIX=' ' + +get_kernel() +{ + echo "$PREFIX$(uname -r)" +} + +get_kernel diff --git a/modules/localip b/modules/localip new file mode 100755 index 0000000..39629db --- /dev/null +++ b/modules/localip @@ -0,0 +1,12 @@ +#!/bin/bash + +# Prints out your local IP + +PREFIX='ﯱ ' + +get_local_ip() +{ + echo "$PREFIX$(hostname -i)" +} + +get_local_ip diff --git a/modules/networkdowntraffic b/modules/networkdowntraffic new file mode 100755 index 0000000..f1b5584 --- /dev/null +++ b/modules/networkdowntraffic @@ -0,0 +1,31 @@ +#!/bin/bash + +# Prints out the current down network traffic in MB + +PREFIX=' ' + +get_down_traffic() +{ + RECIEVE1=0 + RECIEVE2=0 + + IFACES=$(ip -o link show | awk -F': ' '{print $2}') + for IFACE in $IFACES; do + if [ $IFACE != "lo" ]; then + RECIEVE1=$(($(ip -s -c link show wlan0 | tail -n3 | head -n 1 | cut -d " " -f5) + $RECIEVE1)) + fi + done + + sleep 1 + + IFACES=$(ip -o link show | awk -F': ' '{print $2}') + for IFACE in $IFACES; do + if [ $IFACE != "lo" ]; then + RECIEVE2=$(($(ip -s -c link show wlan0 | tail -n3 | head -n 1 | cut -d " " -f5) + $RECIEVE2)) + fi + done + + echo "$PREFIX$(expr $(expr $RECIEVE2 - $RECIEVE1 ) / 1000)KB/s" +} + +get_down_traffic diff --git a/modules/networkuptraffic b/modules/networkuptraffic new file mode 100755 index 0000000..6b002e6 --- /dev/null +++ b/modules/networkuptraffic @@ -0,0 +1,32 @@ +#!/bin/bash + +# Prints out the current up network traffic in MB + +PREFIX=' ' + +get_up_traffic() +{ + TRANSMIT1=0 + TRANSMIT2=0 + + IFACES=$(ip -o link show | awk -F': ' '{print $2}') + for IFACE in $IFACES; do + if [ $IFACE != "lo" ]; then + TRANSMIT1=$(($(ip -s -c link show wlan0 | tail -n1 | cut -d " " -f5) + TRANSMIT1)) + fi + done + + sleep 1 + + IFACES=$(ip -o link show | awk -F': ' '{print $2}') + for IFACE in $IFACES; do + if [ $IFACE != "lo" ]; then + TRANSMIT2=$(($(ip -s -c link show wlan0 | tail -n1 | cut -d " " -f5) + TRANSMIT2)) + fi + done + + echo "$PREFIX$(expr $(expr $TRANSMIT2 - $TRANSMIT1) / 1000)KB/s" +} + +get_up_traffic + diff --git a/modules/publicip b/modules/publicip new file mode 100755 index 0000000..2e94e04 --- /dev/null +++ b/modules/publicip @@ -0,0 +1,13 @@ +#!/bin/bash + +# Prints out your public IP adress +# Depends on curl + +PREFIX=' ' + +get_pub_ip() +{ + echo "$PREFIX$(curl -s ifconfig.co)" +} + +get_pub_ip diff --git a/modules/src/internet.c b/modules/src/internet.c new file mode 100644 index 0000000..d0f6afd --- /dev/null +++ b/modules/src/internet.c @@ -0,0 +1,10 @@ +#include <stdio.h> + +int main() +{ + char *internet_icon = ""; + + printf("%s\n", internet_icon); + + return 0; +} diff --git a/modules/voidupdates b/modules/voidupdates new file mode 100755 index 0000000..229fd42 --- /dev/null +++ b/modules/voidupdates @@ -0,0 +1,16 @@ +#!/bin/bash + +# Prints the number of updates for Void Linux + +PREFIX=' Updates: ' + +get_updates() +{ + if ! updates=$(xbps-install -Mun 2> /dev/null | wc -l ); then + updates=0 + fi + + echo "$PREFIX$updates" +} + +get_updates |