aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMitch Riedstra <mitch@riedstra.us>2018-11-07 23:47:38 -0500
committerMitch Riedstra <mitch@riedstra.us>2018-11-07 23:47:38 -0500
commitb359a2406c888db5286a5fd5937f3cb4740b634a (patch)
tree925ba19f81f0388f0958cccc5ccf4647c802163c
parenta18a1072780edb87bd1e934010af2f7126f301bb (diff)
downloaddotfiles-b359a2406c888db5286a5fd5937f3cb4740b634a.tar.gz
dotfiles-b359a2406c888db5286a5fd5937f3cb4740b634a.tar.xz
update helper functions in tmux
-rw-r--r--tmux.conf5
-rw-r--r--tmux_helper.sh15
2 files changed, 11 insertions, 9 deletions
diff --git a/tmux.conf b/tmux.conf
index b6fb6a7..ed59b92 100644
--- a/tmux.conf
+++ b/tmux.conf
@@ -45,14 +45,15 @@ bind-key M-r respawn-pane
# Change the status line a little bit, most are close to defaults
set -g status-left-length 16
set -g status-left "[#S] "
-set -g status-right "#[fg=green,bg=black] #(whoami)@#h|m:#(sh $HOME/.tmux_helper.sh memory)|l:#(sh $HOME/.tmux_helper.sh load)|#(sh $HOME/.tmux_helper.sh s_uptime)"
+set -g status-right "#[fg=green,bg=black] #(whoami)@#h|m:#(sh $HOME/.tmux_helper.sh memory)|l:#(sh $HOME/.tmux_helper.sh load)|#(sh $HOME/.tmux_helper.sh uptime)"
set -g status-right-length 40
set -g window-status-format "#I:#W#F"
# If you still want to select text out of the terminal as you normally would
-# You should hold the shift key ( Linux ) I'm told it's "Option on Mac OS X"
+# You should hold the shift key ( Linux ) Option/Alt works in iTerm2 on MacOS
+# Does not seem to work with the native terminal.
set -g mouse on
# Old mouse method
diff --git a/tmux_helper.sh b/tmux_helper.sh
index 7ba09ee..7ce68bd 100644
--- a/tmux_helper.sh
+++ b/tmux_helper.sh
@@ -2,26 +2,27 @@
# Little helper script to clean up the nasty embeded commands in my tmux configuration
-# Be careful if you add commands that you don't cause infinite recursion by calling
-# a command the same name as an executable on the system you're using. e.g. uptime() { uptime | sed ... }
+# Functions ripped out of `mkshrc`, worth checking out
-memory() {
+_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
}
-load() {
+_sys_load() {
# Works on BSD too, neat.
uptime | sed -re's/^.*load averages?: ([0-9]+\.[0-9]+).*$/\1/g'
}
-s_uptime() {
+_sys_uptime() {
# Took awhile to figure out, but this works on BSD as well
- uptime | sed -re's/^.*up[ ]+//g' -e's/^([^,]*),.*/u:\1/g' -e's/^([^ ]+)[ ]*(.).*/\1\2/g'
+ uptime | sed -re's/^.*up[ ]+//g' -e's/^([^,]*),.*/\1/g' -e's/^([^ ]+)[ ]*(.).*/\1\2/g'
}
-$1
+_sys_$1