Giter Club home page Giter Club logo

windy's Introduction

๐Ÿƒ windy

License: MIT

An SDL3 widget that attempts to looks like the good ol' Windows Vista/7 weather widget

Introduction

Even though I'm a Linux user 99% of the time, one of the few things I miss is the weather widget from Windows Vista/7: it's simple, but I genuinely find it attractive and useful.

While there are various weather widgets for Linux using Conky, I've never come across one that resembled the Windows 7 version. So, I decided to create my own with C and SDL3. Windy is open source and works on Linux, FreeBSD, MacOS, and Windows.

Windy:

Windy examples
Windy examples

How to use

Quick Explanation:

Change the following lines of request.py file with the lat/long of your city (exact location not needed!):

#
# Example:
# LATITUDE="35.69"
# LONGITUDE="139.69"
# LOCATION="Tokyo, Japan"
#
LATITUDE="<change to your location>"
LONGITUDE="<change to your location>"
LOCATION="<City, State>"

and then run:

$ ./windy -c "python request.py"

Detailed Explanation:

Unlike most weather programs/widgets, Windy doesn't attempt to embed one or more forecast APIs within itself. Instead, it delegates this responsibility to an external program/script.

Windy accomplishes this by invoking an external script provided as a parameter by the user. This script returns JSON output through stdout, which Windy reads and displays on the screen. Essentially, Windy serves as a GUI for an external program.

By default, Windy provides the request.py script, which uses the OpenMeteo's API to fetch weather information. However, users can supply any script, program, etc., in their preferred language, as long as it follows the JSON format below:

{
    "temperature": 22,
    "condition": "clear",
    "max_temp": 20,
    "min_temp": 15,
    "location": "Tokyo, Japan",
    "provider": "OpenMeteo",
    "forecast": [
        {
            "max_temp": 34,
            "min_temp": 27,
            "condition": "rainfall"
        },
        {
            "max_temp": 34,
            "min_temp": 27,
            "condition": "clouds"
        },
        {
            "max_temp": 34,
            "min_temp": 27,
            "condition": "clouds"
        }
    ]
}

acceptable values for condition are: clear, fog, clouds, showers, rainfall, thunder, and snow.

Command-line arguments:

Windy also supports changing the weather update interval (-t) and the screen coordinates (-x and -y) where it should appear. Below are all the available options:

$ ./windy -h
Usage: ./windy [options] -c <command-to-run>
Options:
  -t           Interval time (in seconds) to check for weather
               updates (default = 10 minutes)
  -c <command> Command to execute when the update time reaches
  -x <pos>     Set the window X coordinate
  -y <pos>     Set the window Y coordinate
  -h           This help

Example:
 Update the weather info each 30 minutes, by running the command
 'python request.py'
    $ ./windy -t 1800 -c "python request.py"

Obs: Options -t,-x and -y are not required, -c is required!

Building

Windy requires SDL31 and SDL3_ttf to build, if you don't have them installed and your distro/OS doesn't have packages for them (highly likely, as they're still under development) build with CMake:

$ git clone https://github.com/Theldus/windy.git
$ cd windy
$ mkdir build
$ cd build
$ cmake ..
$ make -j4

CMake will check if the libs can be found on the system, and if not, it will download and build them.

Optionally, if you are running Linux and already have the libraries installed on your system, just a 'make' is enough:

$ git clone https://github.com/Theldus/windy.git
$ cd windy
$ make -j4

Contributing

Windy is always open to the community and willing to accept contributions, whether with issues, documentation, testing, new features, bugfixes, typos, and etc. Welcome aboard.

License

Windy is licensed under the MIT license.

Weather icons were created by gnokii and are licensed under the Creative Commons Attribution 3.0 License.

NotoSans font was created by Google and is licensed under the OFL license.

Footnotes

  1. SDL3 is the first version of SDL to support transparent framebuffer, which is why version 3 is required. โ†ฉ

windy's People

Contributors

theldus avatar

Stargazers

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

Watchers

 avatar  avatar

windy's Issues

Location text exceeds available space

First off, I love what you're doing here. It's refreshing to see lightweight applications that don't rely on an entire browser engine, and kudos for using C.

I've noticed a minor issue, though I'm not entirely sure about the best remedy. If the location name is too long, the text can spill out of the window. Here's an example:

image

I can think of a couple of potential solutions:

  1. Dynamically adjust the window size based on the length of the location name, ensuring everything fits.
  2. Use an ellipsis when the location name exceeds the available width.

I'd be interested in your thoughts on this!

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.