How to display your public IP address from the XFCE panel bar
This is a simple method to display the public IP address in your XFCE panel bar with the Generic Monitor XFCE plugin.
You will first need to install the Generic Monitor XFCE plugin package.
sudo apt install xfce4-genmon-plugin
Now you will need to create a shell script. You can save the script wherever you want, but I recommend the “~/.local/bin” directory for such things.
Open a text editor and apply the following:
#!/bin/bash wget -q -O - ipinfo.io/ip || echo "ERROR"
|Alternatively, you can use my web.emhmki.org/ipinfo.php too, instead of the ipinfo.io/ip site.|
Save the shell script and apply the execute permission bit, like the following example.
chmod +x ~/.local/bin/show_ip.sh
Open the XFCE panel preferences. You can right-clicking on an empty space in the panel bar, select Panel, Panel Preferences…
Click on the Items tab from the Panel Preferences window, then click the Add Item button. Keyword search for Generic Monitor, highlight it with your pointer by clicking on it, then click the Add button to add it.
Position the Generic Monitor to a suitable spot on your panel bar, then click on the Edit button to modify the plugin configuration. You could also just right-click on the plugin from the panel bar itself and select Properties.
- Adjust the command input to include your shell script. The full file path may be necessary.
- Adjust the label to whatever you find suitable.
- Adjust the polling rate. I don’t recommend making it shorter than 60 seconds, or else you’re wasting data.
After that, you should begin seeing your public IP address reported in the panel bar.
[Return to top]
If you host your own publicly accessible web server, you can can create a PHP document with simply the following code and you’ll have your very own “What’s my IP?” service!
<?php echo $_SERVER['REMOTE_ADDR'] . "\n";?>
|If you’re running an Apache web server, you may have to install php and the libapache2-mod-php packages, as well as restart the server.|