Replies: 2 comments
-
|
There is no eww builtin that allows for that, but you could do either:
Note that even if there was a way to do that, it wouldn't be much faster anyways, since it would probably be polling the time anyways (to check when to run) |
Beta Was this translation helpful? Give feedback.
0 replies
-
|
I would recommend writing a bash script like #!/usr/bin/env bash
# Log to eww (stderr) instead of sending data (stdout)
function log() {
>&2 echo "$@"
}
# Fetches data that needs to be updated daily
function doOutput() {
log "Getting output"
local dailyData=$(getSomeData)
echo "{ \"dailyData\": \"$dailyData\" }"
}
# Wait until specified time
# See https://unix.stackexchange.com/questions/259660/how-to-sleep-until-a-given-date-time
function waitForTime() {
local targetTime="tomorrow 00:00"
local now=$(date +%s)
local sleepTill=$(date +%s -d "$targetTime")
local sleepTime=$(expr $sleepTill - $now)
log "Sleeping for $sleepTime seconds (until $targetTime)"
sleep sleepTime
}
# Output once so that we get info whenever eww starts up
doOutput
while 1; do
waitForTime
doOutput
donewhich you can then use as (deflisten someData
:initial "{}"
`./path/to/script`)
(defwidget usesSomeData (...)) |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I am using two distinct widgets for time and date, I am updating the time widget every second, but I want to update the date widget only every 24 hours, specifically at 00:00 every day, can I do this?
Beta Was this translation helpful? Give feedback.
All reactions