aboutsummaryrefslogtreecommitdiff
path: root/linux/home/.config/tmux/left-status.sh
diff options
context:
space:
mode:
Diffstat (limited to 'linux/home/.config/tmux/left-status.sh')
-rwxr-xr-xlinux/home/.config/tmux/left-status.sh25
1 files changed, 25 insertions, 0 deletions
diff --git a/linux/home/.config/tmux/left-status.sh b/linux/home/.config/tmux/left-status.sh
new file mode 100755
index 0000000..e4a8c49
--- /dev/null
+++ b/linux/home/.config/tmux/left-status.sh
@@ -0,0 +1,25 @@
+#!/bin/bash
+
+function ip-address() {
+ # Loop through the interfaces and check for the interface that is up.
+ for file in /sys/class/net/*; do
+ iface=$(basename $file);
+ read status < $file/operstate;
+ [ "$status" == "up" ] && ip addr show $iface | awk '/inet /{printf $2""}'
+ done
+}
+
+function vpn-connection() {
+ # Check for tun0 interface.
+ [ -d /sys/class/net/tun0 ] && printf "%s " 'VPN*'
+}
+
+function main() {
+ # Comment out any function you do not need.
+ ip-address
+ vpn-connection
+}
+
+# Calling the main function which will call the other functions.
+main
+