Skip to content

Commit

Permalink
Merge branch 'network-public-ip' of https://github.com/ljseng/tmux-dr…
Browse files Browse the repository at this point in the history
…acula into ljseng-network-public-ip
  • Loading branch information
ethancedwards8 committed Jan 1, 2025
2 parents bc665f9 + 96835e6 commit e948401
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 1 deletion.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ In depth configuration of Colors and alternative themes can be found [in the doc
- Day, date, time, timezone
- [Fully custom color theming](/docs/color_theming/README.md)
- Current location based on network with temperature and forecast icon (if available)
- Network connection status, bandwidth and SSID
- SSH session user, hostname and port of active tmux pane
- Network connection status, bandwidth, SSID and public IP (requires `curl`)
- Git branch and status
- Battery percentage and AC power connection status with icons
- Refresh rate control
Expand Down
4 changes: 4 additions & 0 deletions scripts/dracula.sh
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,10 @@ main()
IFS=' ' read -r -a colors <<< $(get_tmux_option "@dracula-ssh-session-colors" "green dark_gray")
script="#($current_dir/ssh_session.sh $show_ssh_session_port)"

elif [ $plugin = "network-public-ip" ]; then
IFS=' ' read -r -a colors <<<$(get_tmux_option "@dracula-network-public-ip-colors" "cyan dark_gray")
script="#($current_dir/network-public-ip.sh)"

else
continue
fi
Expand Down
18 changes: 18 additions & 0 deletions scripts/network-public-ip.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/usr/bin/env bash

# setting the locale, some users have issues with different locales, this forces the correct one
export LC_ALL=en_US.UTF-8

current_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
source $current_dir/utils.sh

main() {
IP_SERVER="ifconfig.me"
ip=$(curl -s "$IP_SERVER")

IP_LABEL=$(get_tmux_option "@dracula-network-public-ip-label" "")
echo "$IP_LABEL $ip"
}

# run the main driver
main

0 comments on commit e948401

Please sign in to comment.