From: Sergey Matveev <stargrave@stargrave.org>
Date: Wed, 5 Aug 2020 13:59:34 +0000 (+0300)
Subject: Memory information in dwm status bar
X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=17bcc246a3515b838a7cd61bb9b0b745ef0f67bd;p=dotfiles.git

Memory information in dwm status bar
---

diff --git a/bin/bin/xstatusbar.sh b/bin/bin/xstatusbar.sh
new file mode 100755
index 0000000..dc5c66c
--- /dev/null
+++ b/bin/bin/xstatusbar.sh
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+while :; do
+    life=$(apm -l)
+    [ -e /tmp/do-fdm ] && fdm_state="FM" || fdm_state=""
+    topinfo=$(top -b -d 1 0 | sed s/[,:]//g)
+    meminfo=$(echo "$topinfo" | grep "^Mem")
+    arcinfo=$(echo "$topinfo" | grep "^ARC")
+    xsetroot -name "$meminfo | $arcinfo | $fdm_state $life% $(date "+%Y-%m-%dT%H:%M:%S")"
+    sleep 20
+done
diff --git a/x/.xinitrc b/x/.xinitrc
index 89f7c19..3707878 100755
--- a/x/.xinitrc
+++ b/x/.xinitrc
@@ -4,12 +4,7 @@ xsetroot -solid \#222222 &
 xset b off
 # xrdb ~/.Xresources
 xmodmap ~/.Xmodmap
-while :; do
-    life=$(apm -l)
-    [ -e /tmp/do-fdm ] && fdm_state="FM" || fdm_state=""
-    xsetroot -name "$fdm_state $life% $(date "+%Y-%m-%dT%H:%M:%S")"
-    sleep 20
-done &
+~/bin/xstatusbar.sh &
 rm -f ~/.ssh/agent ; ssh-agent -a ~/.ssh/agent
 ~/bin/cleanup.sh
 exec $HOME/src/suckless/dwm/dwm