An open API service indexing awesome lists of open source software.

https://github.com/mamantoha/air_alert_map_ua_wallpaper

A CLI tool for setting the Air Raid Alert Map of Ukraine as a desktop background
https://github.com/mamantoha/air_alert_map_ua_wallpaper

crystal kde-plasma macos wallpaper-changer windows

Last synced: about 1 year ago
JSON representation

A CLI tool for setting the Air Raid Alert Map of Ukraine as a desktop background

Awesome Lists containing this project

README

          

# air_alert_map_ua_wallpaper

A CLI tool for setting the Air Raid Alert Map of Ukraine as a desktop background

![preview](preview.png)

## About

This script takes a screenshot of the site and set it as a desktop background.

Support:

- [x] KDE Plasma (Linux)
- [x] macOS (Somona)
- [x] Windows

Required libraries:

- To build this script, a requirement is to have a working version of Crystal already installed.
- A requirement is to have a working `chromedriver` or `geckodriver`.
- You will also need `dbus-send` on KDE Plasma.

```
$ air_alert_map_ua_wallpaper --help
NAME
air_alert_map_ua_wallpaper - a CLI tool for setting the Air Raid Alert Map of Ukraine as a desktop background

VERSION
0.1.0

SYNOPSIS
air_alert_map_ua_wallpaper [arguments]

ARGUMENTS
-b, --browser=NAME browser: chrome|firefox (default: chrome)
-w, --width=PIXELS specify a desired width in pixels (default: 2560)
-h, --height=PIXELS specify a desired height in pixels (default: 1440)
-l, --language=NAME language uk|en|de|pl|ja|crh (default: uk)
--light set light wallpaper
-p, --preset=NAME preset default|contrast|vadym|st|black (default: default)
-m, --map=NAME map dynamic|super|vbasic|hex (default: dynamic)
--hide-date hide date
--help print this help
-v, --version display the version and exit
```

## Install

- Clone this repository `git@github.com:mamantoha/air_alert_map_ua_wallpaper.git && cd air_alert_map_ua_wallpaper`
- Build with `shards build --release`
- Run with `./bin/air_alert_map_ua_wallpaper` or move it to any directory in `$PATH`

## Usage

Set the wallpaper with a custom resolution:

```
air_alert_map_ua_wallpaper -w 3456 -h 2234
```

### Linux

To change background every 5 minutes the following command:

```
crontab -e
```

and add the following to the opened file:

```
*/5 * * * * env DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$(id -u)/bus ~/bin/air_alert_map_ua_wallpaper
```

### macOS

Create a plist file called `com.example.air_alert_map_ua_wallpaper.plist` in the `~/Library/LaunchAgents directory`.

Add the following content to the plist file `~/Library/LaunchAgents/com.example.air_alert_map_ua_wallpaper.plist`:

```xml

Label
com.example.air_alert_map_ua_wallpaper
ProgramArguments

/bin/bash
-c

export PATH=$PATH:/opt/homebrew/bin
while true; do ~/bin/air_alert_map_ua_wallpaper; sleep 300; done


RunAtLoad

StandardOutPath
/tmp/air_alert_map_ua_wallpaper.log
StandardErrorPath
/tmp/air_alert_map_ua_wallpaper.log

```
Load the launch agent into your current session using launchctl:

```
launchctl load ~/Library/LaunchAgents/com.example.air_alert_map_ua_wallpaper.plist
```

Now, the script should run every 5 minutes within user's active session.

To check the status of a launch agent:

```
launchctl list | grep com.example.air_alert_map_ua_wallpaper
```

## Contributing

1. Fork it ()
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create a new Pull Request

## Contributors

- [Anton Maminov](https://github.com/mamantoha) - creator and maintainer