A CLI tool for setting the Air Raid Alert Map of Ukraine as a desktop background
MIT License
A CLI tool for setting the Air Raid Alert Map of Ukraine as a desktop background
This script takes a screenshot of the https://alerts.in.ua site and set it as a desktop background.
Support:
Required libraries:
chromedriver
or geckodriver
.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
[email protected]:mamantoha/air_alert_map_ua_wallpaper.git && cd air_alert_map_ua_wallpaper
shards build --release
./bin/air_alert_map_ua_wallpaper
or move it to any directory in $PATH
Set the wallpaper with a custom resolution:
air_alert_map_ua_wallpaper -w 3456 -h 2234
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
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 version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.example.air_alert_map_ua_wallpaper</string>
<key>ProgramArguments</key>
<array>
<string>/bin/bash</string>
<string>-c</string>
<string>
export PATH=$PATH:/opt/homebrew/bin
while true; do ~/bin/air_alert_map_ua_wallpaper; sleep 300; done
</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>StandardOutPath</key>
<string>/tmp/air_alert_map_ua_wallpaper.log</string>
<key>StandardErrorPath</key>
<string>/tmp/air_alert_map_ua_wallpaper.log</string>
</dict>
</plist>
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
git checkout -b my-new-feature
)git commit -am 'Add some feature'
)git push origin my-new-feature
)