pentest-distro-builder/filesystem/etc/skel/.tmux/plugins/tmux-net-speed/net_speed.tmux
Kaj Forney a6d12f1ffc Move stuff to /etc/skel
Former-commit-id: 7bddceacd727c25153cd0ec03cf8b0d4011484d5
Former-commit-id: aaf57e63c1976b3960fee717c68c3b09dc1a94ff
2018-10-18 13:47:28 -06:00

36 lines
923 B
Bash
Executable file

#!/bin/bash -
CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
source "$CURRENT_DIR/scripts/helpers.sh"
download_speed="#($CURRENT_DIR/scripts/download_speed.sh)"
net_speed="#($CURRENT_DIR/scripts/net_speed.sh)"
upload_speed="#($CURRENT_DIR/scripts/upload_speed.sh)"
download_interpolation="\#{download_speed}"
net_interpolation="\#{net_speed}"
upload_interpolation="\#{upload_speed}"
do_interpolation() {
local input=$1
local result=""
result=${input/$download_interpolation/$download_speed}
result=${result/$net_interpolation/$net_speed}
result=${result/$upload_interpolation/$upload_speed}
echo $result
}
update_tmux_option() {
local option=$1
local option_value=$(get_tmux_option "$option")
local new_option_value=$(do_interpolation "$option_value")
set_tmux_option "$option" "$new_option_value"
}
main() {
update_tmux_option "status-right"
update_tmux_option "status-left"
}
main