Giter VIP home page Giter VIP logo

tmux-public-ip's Introduction

Tmux Public IP Plugin

Shows your Public IP address and/or other data (like Country, City, GPS Coordinates, ISP, etc.), provided in JSON format by ifconfig.co, ipinfo.io and others.

The plugin will add new #{public_ip} format, which you can use in status-left or status-right.

You can add the JSON key as parameter. Default is 'ip'.

Example:

set -g status-right "IP: #{public_ip} | Country #{public_ip country} | #{public_ip city} | %a %h-%d %H:%M "

Check out ifconfig.co JSON output (or your provider's JSON) for possible parameters.

Plugin Configuration:

param description default
@public_ip_dir Temp dir to store JSON cache file ~/.tmux/public_ip.tmp
@public_ip_tmp_file Temp file for JSON data (saved in temp dir) info.json
@public_ip_json_url URL for JSON data https://ifconfig.co/json
@public_ip_refresh_seconds Time before refreshing the data. Most providers will ban you if you refresh more than once in a minute 60

Example configuration:

set -g @public_ip_dir '/tmp'
set -g @public_ip_tmp_file 'tmux-pip.json'
set -g @public_ip_json_url 'https://ipinfo.io/json'
set -g @public_ip_refresh '120'

Installation with Tmux Plugin Manager (recommended)

Add plugin to the list of TPM plugins in .tmux.conf:

set -g @plugin '0xAF/tmux-public-ip'

Hit prefix + I to fetch the plugin and source it.

#{public_ip} interpolation should now work.

Manual Installation

Clone the repo:

$ git clone https://github.com/0xAF/tmux-public-ip ~/clone/path

Add this line to the bottom of .tmux.conf:

run-shell ~/clone/path/tmux-public-ip.tmux

Reload TMUX environment:

# type this in terminal
$ tmux source-file ~/.tmux.conf

#{public_ip} interpolation should now work.

License

WTFPL

tmux-public-ip's People

Contributors

0xaf avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

tmux-public-ip's Issues

IP address disappears from status line

I am experiencing a rather strange issue with the plugin. After installing and setting it up in the status line, the IP address appears... and disappears in the blink of an eye. See the following GIF (look at what happens before the text ip test).

ezgif-2-687ddd701c

The only way to let the address reappear is by changing the Public IP temp file.

I am using this on macOS 13.3.1a in iTerm 3.4.19 with zsh 5.9 and Tmux 3.3a.

set -g @public_ip_dir '~/.config/tmux/tmp/'
set -g @public_ip_tmp_file 'public_ip.json'
set -g status-right "#[fg=#586e75,bg=#002b36,nobold,nounderscore,noitalics]#[fg=#93a1a1,bg=#586e75]#[fg=#eee8d5,bg=#586e75,nobold,nounderscore,noitalics] #{public_ip ip}  ip test #[fg=#657b83]#[fg=#eee8da,bg=#657b83] #{weather} #[fg=#93a1a1,bg=#657b83,nobold,nounderscore,noitalics]#[fg=#15161e,bg=#93a1a1,bold] #h  %H:%M:%S⠀#[fg=#93a1a1,bg=#0d1017]⠀"

I also tried different configuration variants like the one in the readme but with no luck.

Any ideas what is going wrong here?

Update: I also notice the JSON file does not get updated after initially creating, but it does get recreated after removing it.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.