Skip to content

Instantly share code, notes, and snippets.

@naranyala
Last active August 10, 2023 03:07
Show Gist options
  • Save naranyala/36a8ddc6363a5aef0d2e938670dcf387 to your computer and use it in GitHub Desktop.
Save naranyala/36a8ddc6363a5aef0d2e938670dcf387 to your computer and use it in GitHub Desktop.
#!/bin/bash
status_01="ENV: mobile | INTERNET: ☑️"
status_02="ENV: mobile | INTERNET: ❎"
status_03="ENV: desktop | INTERNET: ☑️"
status_04="ENV: desktop | INTERNET: ❎"
# conditional tmux statusbar
if [[ $TERMUX_VERSION ]]; then
if ping -c 1 "google.com" >/dev/null 2>&1 ; then
tmux display-message -d 3000 "[TMUX] $status_01"
else
tmux display-message -d 3000 "[TMUX] $status_02"
fi
# tmux display-message -d 1000 "[TMUX] you are on mobile"
tmux set -g status-justify left
tmux set -g status-left ""
tmux set -g status-right "#[fg=colour47] #S "
else
if ping -c 1 "google.com" >/dev/null 2>&1 ; then
tmux display-message -d 3000 "[TMUX] $status_01"
else
tmux display-message -d 3000 "[TMUX] $status_02"
fi
# tmux display-message -d 1000 "[TMUX] you are on desktop"
tmux set -g status-justify centre
tmux set -g status-left "#[fg=colour47] #(whoami) @ #h "
tmux set -g status-right "#[fg=colour47] #S | %R %P| %d %b %Y "
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment