forked from matryer/xbar-plugins
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request matryer#1461 from codincafe/patch-1
My External IP
- Loading branch information
Showing
1 changed file
with
23 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#!/bin/bash | ||
|
||
# <bitbar.title>My External IP</bitbar.title> | ||
# <bitbar.version>v1.0</bitbar.version> | ||
# <bitbar.author>CodinCafe</bitbar.author> | ||
# <bitbar.author.github>codincafe</bitbar.author.github> | ||
# <bitbar.desc>This plugin will show your current external / public IP and allow you to copy the same to clipboard</bitbar.desc> | ||
# <bitbar.image>https://i.imgur.com/Ar1JABA.png</bitbar.image> | ||
# <bitbar.dependencies>curl</bitbar.dependencies> | ||
|
||
echo "🌎" | ||
echo '---' | ||
|
||
if [ $(curl -LI http://google.com -o /dev/null -w '%{http_code}\n' -s) == "200" ]; then | ||
OUTPUT=$(curl -s https://ipinfo.io/ip) | ||
result_string="$OUTPUT | bash='/bin/bash' param1='-c' param2='/bin/echo $OUTPUT | pbcopy' terminal=false"; | ||
else | ||
result_string="No Internet Connection" | ||
fi | ||
|
||
echo "$result_string" | ||
echo --- | ||
echo "Refresh... | refresh=true" |