Skip to content

Commit e948401

Browse files
Merge branch 'network-public-ip' of https://github.com/ljseng/tmux-dracula into ljseng-network-public-ip
2 parents bc665f9 + 96835e6 commit e948401

File tree

3 files changed

+23
-1
lines changed

3 files changed

+23
-1
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ In depth configuration of Colors and alternative themes can be found [in the doc
2323
- Day, date, time, timezone
2424
- [Fully custom color theming](/docs/color_theming/README.md)
2525
- Current location based on network with temperature and forecast icon (if available)
26-
- Network connection status, bandwidth and SSID
2726
- SSH session user, hostname and port of active tmux pane
27+
- Network connection status, bandwidth, SSID and public IP (requires `curl`)
2828
- Git branch and status
2929
- Battery percentage and AC power connection status with icons
3030
- Refresh rate control

scripts/dracula.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,10 @@ main()
300300
IFS=' ' read -r -a colors <<< $(get_tmux_option "@dracula-ssh-session-colors" "green dark_gray")
301301
script="#($current_dir/ssh_session.sh $show_ssh_session_port)"
302302

303+
elif [ $plugin = "network-public-ip" ]; then
304+
IFS=' ' read -r -a colors <<<$(get_tmux_option "@dracula-network-public-ip-colors" "cyan dark_gray")
305+
script="#($current_dir/network-public-ip.sh)"
306+
303307
else
304308
continue
305309
fi

scripts/network-public-ip.sh

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#!/usr/bin/env bash
2+
3+
# setting the locale, some users have issues with different locales, this forces the correct one
4+
export LC_ALL=en_US.UTF-8
5+
6+
current_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
7+
source $current_dir/utils.sh
8+
9+
main() {
10+
IP_SERVER="ifconfig.me"
11+
ip=$(curl -s "$IP_SERVER")
12+
13+
IP_LABEL=$(get_tmux_option "@dracula-network-public-ip-label" "")
14+
echo "$IP_LABEL $ip"
15+
}
16+
17+
# run the main driver
18+
main

0 commit comments

Comments
 (0)