Hello.
I want to share with you the idea of writing similar informational widgets in PHP.
The bottom line is that PHP tools make it easy to grab or simply receive information from the Internet (+ personal preferences for this language), after which this information can be displayed using the notify-send utility, beautifully and succinctly in the right corner of the monitor.
I will say right away that I do not pretend to be innovative. Perhaps this method may seem rather silly to many, but I, for example, find it easier to look into a corner of the monitor than to score a desktop with all sorts of screenlets, horse skins and other things.
As an example, create a weather widget based on data from openweathermap.com.
We need a web server with PHP, no matter on localhost or not.
Create a directory on the server in which the widgets will be located, I have this / public_html / scripts /.
Let's start the first part - PHP:
Create a file with the name, for example, weather.php. Created? Fine. Now let's get the data from openweathermap.com. They have their own API for these purposes, which can be found on
the same site , so we will not dwell on it.
First we need to get the ID of the city we need. To do this, find this city on the site and see detailed information about it. In the address bar we will see the identifier.
For my city, the link looks like this: openweathermap.org/city/
705812 , the actual identifier here is 705812.
Great, now we know the city id and can get data using the API
')
Listing weather.php:
<?php error_reporting(0); Header('Content-Type: text/html; charset=utf-8'); function getWeather($id) { if(!empty($id)) { $json = file_get_contents('http://openweathermap.org/data/weather/'.$id.'?type=json'); $weatherData = json_decode($json, true); return $weatherData; } } $weather = getWeather('705812');
The second part is the Shell script.
Everything is simple. We receive the contents of our page with the data in a file, write its contents into a variable and output it via notify-send, using the icon removed from the server.
I put the shell script in my home directory with the name weather.sh
Listing weather.sh:
Ps. If anyone has a way to make this option easier, then I will be glad to hear.
Conclusion
When calling a shell script, we get something similar to this:

And then you can output every minute / hour / day, etc. over the crown, either assign a hotkey to it via Compiz or something else. There is already a matter of personal preference.
I hope this material will seem useful to someone.
Thanks for attention.