mirror of
https://github.com/elenapan/dotfiles.git
synced 2025-12-27 07:44:56 +08:00
Make evil remote watch temp files specific to configuration
This makes it so that whenever the user changes a configuration option such as weather city ID, they do not have to delete the daemon's temp file in order to force an update in the next restart of AwesomeWM
This commit is contained in:
parent
7dbfe4360b
commit
55ba4eb3df
2 changed files with 6 additions and 6 deletions
|
|
@ -9,8 +9,8 @@ local helpers = require("helpers")
|
|||
local naughty = require("naughty")
|
||||
|
||||
local update_interval = 60 * 60 * 12 -- 12 hours
|
||||
local country = user.coronavirus_country or "usa"
|
||||
local temp_file = "/tmp/awesomewm-evil-coronavirus"
|
||||
local country = user.coronavirus_country or "germany"
|
||||
local temp_file = "/tmp/awesomewm-evil-coronavirus-"..country
|
||||
|
||||
local coronavirus_script = [[
|
||||
sh -c '
|
||||
|
|
|
|||
|
|
@ -12,21 +12,21 @@ local city_id = user.openweathermap_city_id
|
|||
local units = user.weather_units
|
||||
-- Don't update too often, because your requests might get blocked for 24 hours
|
||||
local update_interval = 1200
|
||||
local temp_file = "/tmp/awesomewm-evil-weather"
|
||||
local temp_file = "/tmp/awesomewm-evil-weather-"..city_id.."-"..units
|
||||
|
||||
local weather_details_script = [[
|
||||
bash -c '
|
||||
KEY="]]..key..[["
|
||||
CITY="]]..city_id..[["
|
||||
UNITS="]]..units..[["
|
||||
|
||||
|
||||
weather=$(curl -sf "http://api.openweathermap.org/data/2.5/weather?APPID=$KEY&id=$CITY&units=$UNITS")
|
||||
|
||||
|
||||
if [ ! -z "$weather" ]; then
|
||||
weather_temp=$(echo "$weather" | jq ".main.temp" | cut -d "." -f 1)
|
||||
weather_icon=$(echo "$weather" | jq -r ".weather[].icon" | head -1)
|
||||
weather_description=$(echo "$weather" | jq -r ".weather[].description" | head -1)
|
||||
|
||||
|
||||
echo "$weather_icon" "$weather_description"@@"$weather_temp"
|
||||
else
|
||||
echo "..."
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue