aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--TODO.org3
-rwxr-xr-xbar.sh10
-rwxr-xr-xmodules/hostname12
-rwxr-xr-xmodules/internetbin16536 -> 16536 bytes
-rwxr-xr-xmodules/networkdowntraffic4
-rwxr-xr-xmodules/networkuptraffic4
-rw-r--r--modules/src/internet.c2
7 files changed, 23 insertions, 12 deletions
diff --git a/TODO.org b/TODO.org
index 825a3bf..395c5d0 100644
--- a/TODO.org
+++ b/TODO.org
@@ -12,10 +12,9 @@ Each module writes to stdout.
* Todo List
- Delay in archupdates module (if minutes divisible by 5/4)
- Add dependencies like bc
-- Add hostname module
Bugs to fix:
-None
+none
Modules to Write:
- We are more than welcome to accept ideas and pull requests for future
diff --git a/bar.sh b/bar.sh
index 1055177..ca7df84 100755
--- a/bar.sh
+++ b/bar.sh
@@ -53,12 +53,12 @@ run_module()
{
if [[ -f "$CUSTOM_DIR$1" ]]
then
- out="$(exec $CUSTOM_DIR$1)"
+ out="$($CUSTOM_DIR$1)"
else
- out="$(exec $MODULES_DIR$1)"
+ out="$($MODULES_DIR$1)"
fi
- [[ ! "$out" = "" ]] && [[ ! "$module" = "NULL" ]] && out="$out$SEPARATOR."
+ [[ ! "$out" = "" ]] && out="$out$SEPARATOR."
echo "$out" > "$OUTPUT_CACHE$module"
}
@@ -67,10 +67,10 @@ run()
get_internet
for module in $MODULES; do
pgrep $module &> /dev/null
- if [[ $INTERNET -eq 0 ]] && [[ $? -eq 1 ]]; then
+ if [[ $? -eq 1 ]] && [[ $INTERNET -eq 0 ]]; then
run_module $module &
else
- [[ $ONLINE_MODULES != *"$module"* ]] && run_module $module
+ [[ "$ONLINE_MODULES" != *"$module"* ]] && run_module $module
fi
done
get_bar
diff --git a/modules/hostname b/modules/hostname
new file mode 100755
index 0000000..41ec4fa
--- /dev/null
+++ b/modules/hostname
@@ -0,0 +1,12 @@
+#!/bin/bash
+
+# Prints USER@hostname
+
+PREFIX=' '
+
+get_hostname()
+{
+ echo "$PREFIX$USER@$(hostname)"
+}
+
+get_hostname
diff --git a/modules/internet b/modules/internet
index 6fe6aec..22cbd6a 100755
--- a/modules/internet
+++ b/modules/internet
Binary files differ
diff --git a/modules/networkdowntraffic b/modules/networkdowntraffic
index f1b5584..e8d3a74 100755
--- a/modules/networkdowntraffic
+++ b/modules/networkdowntraffic
@@ -12,7 +12,7 @@ get_down_traffic()
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))
+ RECIEVE1=$(($(ip -s -c link show $IFACE | tail -n3 | head -n 1 | cut -d " " -f5) + $RECIEVE1))
fi
done
@@ -21,7 +21,7 @@ get_down_traffic()
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))
+ RECIEVE2=$(($(ip -s -c link show $IFACE | tail -n3 | head -n 1 | cut -d " " -f5) + $RECIEVE2))
fi
done
diff --git a/modules/networkuptraffic b/modules/networkuptraffic
index 6b002e6..396e969 100755
--- a/modules/networkuptraffic
+++ b/modules/networkuptraffic
@@ -12,7 +12,7 @@ get_up_traffic()
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))
+ TRANSMIT1=$(($(ip -s -c link show $IFACE | tail -n1 | cut -d " " -f5) + TRANSMIT1))
fi
done
@@ -21,7 +21,7 @@ get_up_traffic()
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))
+ TRANSMIT2=$(($(ip -s -c link show $IFACE | tail -n1 | cut -d " " -f5) + TRANSMIT2))
fi
done
diff --git a/modules/src/internet.c b/modules/src/internet.c
index d0f6afd..916445b 100644
--- a/modules/src/internet.c
+++ b/modules/src/internet.c
@@ -2,7 +2,7 @@
int main()
{
- char *internet_icon = "";
+ char *internet_icon = " ";
printf("%s\n", internet_icon);