aboutsummaryrefslogtreecommitdiff
path: root/tmux/bin/tmux-status
diff options
context:
space:
mode:
authorxero <x@xero.nu>2015-11-01 15:55:06 -0500
committerxero <x@xero.nu>2015-11-01 15:55:06 -0500
commitaa72865287771a7f4c194a2e61dcdcecc9f063f7 (patch)
tree24d1532fcd2d71bc31681749ecdd12d15da67493 /tmux/bin/tmux-status
parente60ae25bddb4df917c0960db8c14ba1fbc18f86a (diff)
downloaddotfiles_ascii-aa72865287771a7f4c194a2e61dcdcecc9f063f7.tar.xz
dotfiles_ascii-aa72865287771a7f4c194a2e61dcdcecc9f063f7.zip
update tmux statusbar to use ~/bin
Diffstat (limited to 'tmux/bin/tmux-status')
-rwxr-xr-xtmux/bin/tmux-status111
1 files changed, 111 insertions, 0 deletions
diff --git a/tmux/bin/tmux-status b/tmux/bin/tmux-status
new file mode 100755
index 0000000..030924d
--- /dev/null
+++ b/tmux/bin/tmux-status
@@ -0,0 +1,111 @@
+#!/bin/sh
+# ██
+# ░██
+# ██████ ██████████ ██ ██ ██ ██
+# ░░░██░ ░░██░░██░░██░██ ░██░░██ ██
+# ░██ ░██ ░██ ░██░██ ░██ ░░███
+# ░██ ░██ ░██ ░██░██ ░██ ██░██
+# ░░██ ███ ░██ ░██░░██████ ██ ░░██
+# ░░ ░░░ ░░ ░░ ░░░░░░ ░░ ░░
+# ██ ██
+# ░██ ░██
+# ██████ ██████ ██████ ██████ ██ ██ ██████
+# ██░░░░ ░░░██░ ░░░░░░██ ░░░██░ ░██ ░██ ██░░░░
+#░░█████ ░██ ███████ ░██ ░██ ░██░░█████
+# ░░░░░██ ░██ ██░░░░██ ░██ ░██ ░██ ░░░░░██
+# ██████ ░░██ ░░████████ ░░██ ░░██████ ██████
+#░░░░░░ ░░ ░░░░░░░░ ░░ ░░░░░░ ░░░░░░
+#
+# ▓▓▓▓▓▓▓▓▓▓
+# ░▓ author ▓ xero <x@xero.nu>
+# ░▓ code ▓ http://code.xero.nu/dotfiles
+# ░▓ mirror ▓ http://git.io/.files
+# ░▓▓▓▓▓▓▓▓▓▓
+# ░░░░░░░░░░
+
+FULL=▓
+EMPTY=░
+EOL=▒
+SIZE=7
+C0="#000000"
+C1="#222222"
+C2="#1C596E"
+C3="#B3291C"
+C4="#3A3A3A"
+C5="#efefef"
+C6="#878787"
+C7="#8787af"
+
+draw()
+{
+ perc=$1
+ SIZE=$2
+ inc=$(( perc * SIZE / 100 ))
+ out=
+ thiscolor=
+ for v in `seq 0 $(( SIZE - 1 ))`; do
+ test "$v" -le "$inc" \
+ && out="${out}#[fg=$C1]${FULL}" \
+ || out="${out}#[fg=$C1]${EMPTY}"
+ done
+ echo $out
+}
+temp()
+{
+ t=$(sensors | awk '/Core\ 0/ {gsub(/\+/,"",$3); gsub(/\..+/,"",$3) ; print $3}')
+ tc=$C0
+ case 1 in
+ $((t <= 50)))
+ tc=$C2
+ ;;
+ $((t >= 75)))
+ tc=$C3
+ ;;
+ esac
+ echo "#[fg=$tc]$t°c"
+}
+bat()
+{
+ BATPATH=/sys/class/power_supply/BAT1
+ STATUS=$BATPATH/status
+ BAT_FULL=$BATPATH/charge_full
+ BAT_NOW=$BATPATH/charge_now
+ bf=$(cat $BAT_FULL)
+ bn=$(cat $BAT_NOW)
+ stat=$(cat $STATUS)
+ case $stat in
+ Full)
+ st="="
+ ;;
+ Discharging)
+ st="-"
+ ;;
+ Charging)
+ st="+"
+ ;;
+ esac
+ echo $st$(( 100 * $bn / $bf ))"%"
+}
+cpu()
+{
+ CPU_USE=$(grep 'cpu ' /proc/stat | awk '{usage=($2+$4)*100/($2+$4+$5)} END {print usage}')
+ printf "%.0f" $CPU_USE
+}
+ram()
+{
+ free | awk '/Mem:/ {print int($3/$2 * 100.0)}'
+}
+clock()
+{
+ mtime=$(date +'%H:%M')
+ myear=$(date +'%Y-%m-')
+ mday=$(date +'%d')
+ echo "#[fg=$C5]#[bg=$C4] $mtime #[fg=$C6]$myear#[fg=$C5]$mday #[fg=$C6]$EOL"
+}
+front()
+{
+ echo "#[bg=$C7]#[fg=$C1]▓░"
+}
+CPU_INFO=`cpu`
+RAM_INFO=`ram`
+echo `front` `bat` `draw $RAM_INFO 4` `temp` `draw $CPU_INFO 7` `clock`