Linux Weather Bar

A lightweight, feature-rich Bash script that displays live weather, rain forecasts, and moon phase in your Linux status bar or GNOME top bar — powered by OpenWeatherMap and a lunar astronomy API. Works with GNOME (via Executor extension), Waybar, Polybar, i3blocks, and more.


✨ Features

🌦️ Weather Engine


🌙 Advanced Moon System (Highly Accurate)

This is not a simple “show moon phase” feature — it’s a full lunar visibility engine:

🌘 Moon Phase Display

🌕 Moonrise & Moonset Alerts

🌐 Localization


🧠 Smart Time Engine


⚡ Performance & Reliability


🧩 Python Config Manager (GUI)

A major feature of this project is the included:

🖥️ weather_config_editor.py

A modern GTK4 + libadwaita application for managing .weather_config.

🚀 Highlights


📍 Smart Location Picker


🧠 Intelligent Input Types

Special handling for advanced config:


▶️ Running the Config Manager

GSETTINGS_SCHEMA_DIR=. python weather_config_editor.py

Requires:


📸 Example Output

☀️   Clear Sky   32°C (Feels 36°C)    Sunset: 6:18 PM    🌕  Full Moon
⛅️   Few Clouds   28°C    🌧️   Rain Likely ≈ 9:00 PM (73%)
🌫️   Haze   28°C    🌕  পূর্ণিমা
☁️   Scattered Clouds   28°C    🌖  Waning Gibbous
🌫️   Haze   30°C    🌓  First Quarter (শুক্লপক্ষের অর্ধচন্দ্র)
🌦️   Light Rain   26°C
☀️   Clear Sky   32°C    Moonset: 8:24 AM

🔧 Installation

git clone https://github.com/YOUR_USERNAME/linux-weather-bar.git
cd linux-weather-bar

cp .weather_config.template .weather_config
nano .weather_config

chmod +x linux-weather-bar.sh
./linux-weather-bar.sh

⚙️ Configuration

All settings live in:

.weather_config

Required

API_KEY="your_openweathermap_api_key"
LOCATION="lat=23.7626&lon=90.3786"

Moon (Optional)

MOON_API_KEY="your_astroapi_key"
MOON_PHASE_ENABLED=true
TIMEZONE="Asia/Dhaka"

Key Controls

Moon Phase Window

MOON_PHASE_WINDOW_START="moonrise"   # or minutes
MOON_PHASE_WINDOW_DURATION="moonset" # or minutes

Moonrise / Moonset

SHOW_MOONRISE_MOONSET=true
MOONRISE_WARNING_THRESHOLD=30
MOONSET_WARNING_THRESHOLD=30
SHOW_MOONSET_AFTER_SUNRISE=true

Rain Behavior

MOON_PHASE_SHOW_DURING_RAIN=false
MOON_PHASE_SHOW_WITH_RAIN_FORECAST=false

🔌 Bar Integration

GNOME (Executor)

/path/to/linux-weather-bar.sh

Waybar

"custom/weather": {
  "exec": "~/.local/bin/linux-weather-bar.sh",
  "interval": 600
}

Polybar

[module/weather]
type = custom/script
exec = ~/.local/bin/linux-weather-bar.sh
interval = 600

i3blocks

[weather]
command=~/.local/bin/linux-weather-bar.sh
interval=600

📁 Project Structure

linux-weather-bar/
├── linux-weather-bar.sh        # main engine
├── weather_config_editor.py    # GTK config manager
├── .weather_config.template
├── .weather_config            # user config
└── README.md

🌐 APIs

API Purpose
OpenWeatherMap Weather + forecast
AstroAPI Moon phase, moonrise, moonset

🧠 Design Philosophy