aboutsummaryrefslogtreecommitdiff
path: root/tmux/tmux_helper.sh
diff options
context:
space:
mode:
authorMitch Riedstra <mitch@riedstra.us>2019-10-15 20:56:41 -0400
committerMitch Riedstra <mitch@riedstra.us>2019-10-15 20:56:41 -0400
commiteefbd029b55b2782b0d7b11b4989ce0ca9b256cd (patch)
tree535511fd3154342117d67171e28a312bd30c7f87 /tmux/tmux_helper.sh
parent5840f413825e053b645a338d71c1916a06094335 (diff)
downloaddotfiles-eefbd029b55b2782b0d7b11b4989ce0ca9b256cd.tar.gz
dotfiles-eefbd029b55b2782b0d7b11b4989ce0ca9b256cd.tar.xz
Massive organization of my dotfiles
Diffstat (limited to 'tmux/tmux_helper.sh')
-rw-r--r--tmux/tmux_helper.sh28
1 files changed, 28 insertions, 0 deletions
diff --git a/tmux/tmux_helper.sh b/tmux/tmux_helper.sh
new file mode 100644
index 0000000..7ce68bd
--- /dev/null
+++ b/tmux/tmux_helper.sh
@@ -0,0 +1,28 @@
+#!/bin/sh
+
+
+# Little helper script to clean up the nasty embeded commands in my tmux configuration
+# Functions ripped out of `mkshrc`, worth checking out
+
+_sys_memory() {
+ if [ `uname` = "Linux" ] ; then
+ vmstat | tail -n1 | awk '{print $4/1024}' | sed -e's/\..*$//g'
+ elif [ `uname` = "FreeBSD" ] ; then
+ vmstat | tail -n1 | awk '{print $5/1024}' | sed -e's/\..*$//g'
+ elif [ `uname` = "OpenBSD" ] ; then
+ vmstat | sed -n '$p' | awk '{print $4}' | sed 's/M$//'
+ fi
+}
+
+_sys_load() {
+ # Works on BSD too, neat.
+ uptime | sed -re's/^.*load averages?: ([0-9]+\.[0-9]+).*$/\1/g'
+}
+
+_sys_uptime() {
+ # Took awhile to figure out, but this works on BSD as well
+ uptime | sed -re's/^.*up[ ]+//g' -e's/^([^,]*),.*/\1/g' -e's/^([^ ]+)[ ]*(.).*/\1\2/g'
+}
+
+
+_sys_$1