A daemon for receiving desktop National Weather Service notifications through the use of the National Weather Service API (api.weather.gov).
- Periodically fetches real-time weather alerts from the National Weather Service based on a specific latitude and longitude.
- Sends notifications for severe weather alerts based on NWS data.
- Rust (latest stable version recommended)
- Network access to connect to api.weather.gov
- Papirus-Dark icons (if you want per-alert icons)
- Clone the repository:
git clone <repository-url> cd nwsd
- Build the project:
cargo build --release
- Run the binary:
./target/release/nwsd
It is recommended to add the nwsd command to run when you start your desktop environment
nwsd
provides the following commands:
-
run
Starts the daemon to fetch and process weather notifications.nwsd run [--config-directory <path>] [--debug]
Options:
--config-directory
: Specify a custom directory for the configuration file.--debug
: Enable debug mode to log detailed information.
-
init-config
Creates a default configuration file. If the configuration directory is not specified, it will use the default path.nwsd init-config [--config-directory <path>]
-
version
Displays the current version of the application.nwsd version
- Initialize the configuration file:
nwsd init-config
- Start the daemon:
nwsd run --debug
The configuration file is used to customize the behavior of the daemon. By default, the configuration file is created in a standard directory (e.g., ~/.config/nwsd.toml
), but a custom directory can be specified during initialization or runtime.
# Configuration file for NWSD
update_interval = 300 # How often to check the API for weather alerts
lat = 36.974117 # The latitute to check
lon = -122.030792 # The longitude to check
detailed_notification = false # If notifications will contain alert description instead of headline
# notification_icon_path = "/usr/share/icons/someicon.svg" # The notification icon path or comment out to use Papirus-Dark icons
user_agent = "nwsd notification app (https://github.com/Camerooooon/nwsd)"
If you have the papirus-dark icons installed nwsd will by default change the alert icon based on the weather alert. Otherwise you can specify a custom notification_icon_path
that will override this default behavior. If you want to see which alerts correspond with which icons see the get_icon_for_event
function in weather.rs
The NWS API suggests a descriptive user-agent that is unique to every application. It is recommended to make your user-agent unique to prevent rate limiting.
commands/
: Contains the CLI commandsdaemon/
: Core daemon logic for running the service.weather/
: Handles weather-related processing, including parsing and notifications.
- Fork the repository.
- Create a new branch for your feature:
git checkout -b feature-name
- Implement your changes and ensure the code is well-documented.
- Test your changes:
- Submit a pull request.