Xfce Forum

Sub domains
 

You are not logged in.

#1 2023-01-17 14:33:19

christos
Member
Registered: 2023-01-12
Posts: 12

Weather Forecast panel plugin (using genmon)

A while ago I had written a simple weather panel plugin for Mint Os, and having machines using both cinnamon and xfce DEs, I thought I would share it here:
https://gitlab.com/christosangel/weathe … e_cinnamon
Follow the instructions in the README, feel free to give any feedback!

Offline

#2 2023-01-17 16:41:45

christos
Member
Registered: 2023-01-12
Posts: 12

Re: Weather Forecast panel plugin (using genmon)

Also, this is the link for yet another weather plugint hat I wrote.

This is more detailed, as it uses the   free Openweather API (https://openweathermap.org/)

https://gitlab.com/christosangel/weathe … eather-api

Offline

#3 2023-01-17 22:41:43

ToZ
Administrator
From: Canada
Registered: 2011-06-02
Posts: 9,792

Re: Weather Forecast panel plugin (using genmon)

Always like to see genmon out in the wild.

Some suggestions for the first script:

  1. Make the icon path configurable via a variable at the top of the script (the complete gnome icon theme isn't installed on all systems).

  2. Make the click dialog geometry also configurable via variables at the beginning of the script (so the user doesn't need to search the code to change them)

  3. Line 201 has an errant "</clickaction>" towards the end of the line

Thanks for sharing.


Please remember to mark your thread [SOLVED] to make it easier for others to find
--- How To Ask For Help | FAQ | Developer Wiki  |  Community | Contribute ---

Offline

#4 2023-01-17 23:33:24

christos
Member
Registered: 2023-01-12
Posts: 12

Re: Weather Forecast panel plugin (using genmon)

Genmon is a gem.
Thanks for the corrections, I am happy to share, I hope someone finds those scripts useful.
The typo is fixed now (result of adjusting the script from cinnamon to xfce for a  mint mac), the window geometry is also stored in the inequivocably named variable YAD_WINDOW_GEOMETRY, and the README is updated, too.
About the icon theme, I used the gnome theme because it is installed in most systems, not all. There may be a problem as well with the png names, as I am not sure that other themes have the same name for every png used. The solution could be to include a folder containing the necessary icons to the repo. So, if the user wishes to change the icon theme, they will substitute the existing icons, with others, which will have the same name.

Offline

#5 2023-01-23 17:36:58

mocha
Member
Registered: 2022-12-12
Posts: 9

Re: Weather Forecast panel plugin (using genmon)

The first one doesn't work for me.  It just shows the curl text in the genmon, like "% total % received % xferd....."

Offline

#6 2023-01-23 22:11:23

christos
Member
Registered: 2023-01-12
Posts: 12

Re: Weather Forecast panel plugin (using genmon)

Have you followed the instructions on the README?
In the Command field, you should enter : /home/user'sname/path-to-directory/forecast_xfce_cinnamon/Forecast.sh
I have correctd the code, I added the -s flag to the curl command in line 7 to make it silent.
Run the genmon with the corrected version (either download it again or just make the simple correction yourself, in line 7 instead of

curl wttr.in/~Athens,Greece?FQT  -o /tmp/Forecast.txt

,put

curl -s wttr.in/~Athens,Greece?FQT  -o /tmp/Forecast.txt

Let me know if that worked for you.

Last edited by christos (2023-01-23 22:38:12)

Offline

#7 2023-01-24 01:02:04

mocha
Member
Registered: 2022-12-12
Posts: 9

Re: Weather Forecast panel plugin (using genmon)

Still doesn't work.  Now I just get "mkdir: cannot create directory ‘/tmp/Forecast_days’: File exists".  I get the same thing if I run from the command line.  The text files are all populated in the Forecast_days directory.  If I run the yad command from the terminal it brings up the little GUI with the weather data in it..  I don't understand what's wrong.

Offline

#8 2023-01-24 06:38:36

christos
Member
Registered: 2023-01-12
Posts: 12

Re: Weather Forecast panel plugin (using genmon)

I see.I have updated the code to suppress the mkdir warning. Either download it again or just make the simple correction yourself, in line 9, instead of

mkdir /tmp/Forecast_days

put

if [[ ! -d /tmp/Forecast_days ]];then mkdir /tmp/Forecast_days;fi

Let me know if that works for you.

Offline

#9 2023-01-24 07:36:08

mocha
Member
Registered: 2022-12-12
Posts: 9

Re: Weather Forecast panel plugin (using genmon)

Now it just outputs nothing!  I don't understand it, the yad command works fine, and I checked that I have the icons you call for.  My xfce is fairly standard, I made a few changes from default in the window and panel settings but nothing too far out.

Offline

#10 2023-01-24 11:40:03

christos
Member
Registered: 2023-01-12
Posts: 12

Re: Weather Forecast panel plugin (using genmon)

What is the output when you run

./Forecast.sh

from the terminal?
It should be something like:
<txt>...............</txt>
<img>.............</img>
<click>.........</click>
<tool>.....</tool>
You mentioned that /tmp/Forecast.txt and /tmp/Forecast_days get populated, correct?

Offline

#11 2023-01-24 16:33:15

mocha
Member
Registered: 2022-12-12
Posts: 9

Re: Weather Forecast panel plugin (using genmon)

Currently it outputs nothing.  If I revert all the changes you made in the last few posts it looks like this.

$ ./Forecast.sh
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  6573  100  6573    0     0  18448      0 --:--:-- --:--:-- --:--:-- 18463
mkdir: cannot create directory ‘/tmp/Forecast_days’: File exists

Offline

#12 2023-01-24 17:44:14

christos
Member
Registered: 2023-01-12
Posts: 12

Re: Weather Forecast panel plugin (using genmon)

Please open a terminal and run

echo $DESKTOP_SESSION

It should output xfce.

Offline

#13 2023-01-25 06:27:44

mocha
Member
Registered: 2022-12-12
Posts: 9

Re: Weather Forecast panel plugin (using genmon)

$ echo $DESKTOP_SESSION
xubuntu

heheh.. I just changed line 198 to if [ $DESKTOP_SESSION = "xubuntu" ] and now it works.  That's something to consider for people running XFCE based distros.  Thanks!

Last edited by mocha (2023-01-25 06:48:51)

Offline

#14 2023-01-25 13:19:27

christos
Member
Registered: 2023-01-12
Posts: 12

Re: Weather Forecast panel plugin (using genmon)

Well, now we know that this issue that needed resolving, thanks to your feedback.
I have updated the code so that any desktop environment other than cinnamon should be considered xfce, and now gets the output for genmon.

I have also uploaded a png folder that contains the images. Thus any user whose system has not the gnome icons, can point the code to that directory for images.

Offline

Board footer

Powered by FluxBB