From 05a3e848a28d75978b8a5b70c762bed8bc7bfadf Mon Sep 17 00:00:00 2001
From: Valentin Gehrke <madmaurice@zom.bi>
Date: Mon, 8 Jun 2015 18:25:12 +0200
Subject: [PATCH] More infos about updates

---
 scripts/bar.sh     |  6 +++---
 scripts/pkginfo.sh | 27 +++++++++++++++++++++++++++
 2 files changed, 30 insertions(+), 3 deletions(-)
 create mode 100755 scripts/pkginfo.sh

diff --git a/scripts/bar.sh b/scripts/bar.sh
index ccca271..c86e63b 100755
--- a/scripts/bar.sh
+++ b/scripts/bar.sh
@@ -83,8 +83,8 @@ clock() {
 }
 
 updates() {
-    info=$(./cmdcache.sh 20 checkupdates | wc -l)
-    echo -n "$icon_updates $info"
+    updates=$(./cmdcache.sh 20 ./pkginfo.sh)
+    echo -n "$icon_updates $updates"
 }
 
 run_handler() {
@@ -102,5 +102,5 @@ run_handler() {
 while true; do
     echo "%{l} $(music) $(services) $(diskspace)%{r}$(updates) $(wifi) $(battery) $(clock) "
     sleep 1
-done | lemonbar -g 1366x15 -f "Terminus:size=8","Stlarch:size=6:style=regular" -B "#88000000" | run_handler
+done | lemonbar -g 1366x15 -f "Stlarch:size=6:style=regular" -f "Terminus:size=8" -B "#88000000" | run_handler
 
diff --git a/scripts/pkginfo.sh b/scripts/pkginfo.sh
new file mode 100755
index 0000000..e521be3
--- /dev/null
+++ b/scripts/pkginfo.sh
@@ -0,0 +1,27 @@
+#!/bin/bash
+
+internet=$(wicd-cli --status | grep Connected)
+
+pac_updates() {
+    checkupdates | wc -l
+}
+
+aur_updates() {
+    yaourt -Quaq | wc -l
+}
+
+useless_packages() {
+    pacman -Qtdq | wc -l
+}
+
+if [ -Z "$internet" ]; then
+    pac=?
+    aur=?
+else
+    pac=$(pac_updates)
+    aur=$(aur_updates)
+fi
+
+useless=$(useless_packages)
+
+echo "$pac+$aur-$useless"