Comment by ~skin on ~soywod/pimalaya
computation time is not taken into consideration :( I guess I need to rethink the algorithm.
I just wrote a similar timer to comodoro, it uses the
date
command to figure out what "actual" time it is and display that. This results in the timer correcting itself if it gets out of sync.We could do something similar in comodoro, we sleep one second and then we check what time it is using the system clock, compute how many seconds the timer has been running and how much time it has left, and set our internal state to that number.
Here is the script:
#!/bin/sh . "${HOME}/.profile" while [ -n "${1}" ] do name="${1}" shift duration="${1}" shift seconds=$(( ${duration} * 60 )) end=$(( $(date "+%s") + ${seconds} )) notify-send '⌚ Timer' "${name} (${duration} minutes)" play -q "${HOME}/Music/gong.wav" & while [ "${seconds}" -ge 0 ] do time_left="$(printf "%02d:%02d" "$(( ${seconds} / 60 ))" "$(( ${seconds} % 60 ))")" w | awk '/tmux\([0-9]*\)/ { print $2 }' | while read trm do printf '\033]2;%s: %s\033\\' \ "${name}" \ "${time_left}" \ | tee "/dev/${trm}" done clear figlet -d "${HOME}/.local/share/figlet" -f timer -cWt "${time_left}" sleep 1 seconds="$(( ${end} - $(date "+%s") ))" done play -q "${HOME}/Music/ding.wav" & done
In particular, the amount of time we have left on the timer is re-computed against the system clock every second, as per this line:
seconds="$(( ${end} - $(date "+%s") ))"
It can be found at this URL https://git.sr.ht/~skin/dotfiles/tree/main/item/dot-local/bin/timer
Comment by ~skin on ~soywod/pimalaya
Could you share your config? I cannot reproduce. I tried to setup 60s+ timer and all works as expected.
Here it is:
[skin-pom] tcp-host = "localhost" tcp-port = 9999 on-blast-begin = "com-hook Blast" on-blast-running = "com-run Blast" on-pacer-begin = "com-hook Pacer" on-pacer-running = "com-run Pacer" on-rest-begin = "com-hook Rest" on-rest-running = "com-run Rest" on-rest-end = "com-hook Complete" [[skin-pom.cycles]] name = "Blast" duration = 1440 [[skin-pom.cycles]] name = "Pacer" duration = 60 [[skin-pom.cycles]] name = "Rest" duration = 300
During the "Blast" cycle, it would run slow. This is what is happening: the clock is running slow, so that over 24 minutes I gained 6 seconds * 24 minutes = 144 seconds, or two minutes and 24 seconds.
Because of math reasons, I assumed it just added a minute to both the Pacer and the Blast cycles, but in reality what was happening was the clock was just running slow. I caught it in the act, it counts out 9 seconds about every 10 "real" seconds. Thus, after a 24 minute timer, 26 minutes have elapsed. So I got confused initially and thought it was just straight up adding time. I later realized it wasn't, it was just counting time too slow. :shrug:
-- Dan Haskin
Comment by ~skin on ~soywod/pimalaya
Yeah, I caught it in the act. The thing adds a second about every 10 seconds or so. Thus, the clock runs 10% too slow. It does not keep acurate time :(
Comment by ~skin on ~soywod/pimalaya
It's like the clock runs slower or something. Is that possible? I lose like 10 seconds over a minute.
Ticket created by ~skin on ~soywod/pimalaya
For reasons I do not understand, when I set comodoro to any time over 60 seconds, it adds 60 seconds to the time. My 24 minute timer runs for 25 minutes. My 1 minute timer for 2. Etc.
Comment by ~skin on ~soywod/pimalaya
Tinkering some more, looks like I just caught ya mid-debug. I was able to figure out all the stuff commented out, no big deal. Maybe this ticket is just noise.
Comment by ~skin on ~soywod/pimalaya
It's trying to write to
/home/soywod
:P
Comment by ~skin on ~soywod/pimalaya
Configure wizard still broken:
11:06:36 ~/Code/thirdparty/himalaya $ himalaya Himalaya couldn't find an already existing configuration file. First let's setup an account ✔ What is your email address? · djhaskin987@gmail.com ✔ Which name would you like to display with your email? · Daniel Jay Haskin ✔ Which backend would you like to configure your account for? · IMAP ✔ What is your IMAP host: · imap.gmail.com ✔ Which security protocol do you want to use? · SSL/TLS ✔ Which IMAP port would you like to use? · 993 ✔ What is your IMAP login? · djhaskin987@gmail.com ✔ Which IMAP authentication mechanism would you like to use? · OAuth 2.0 ✔ Which sender would you like use with your account? · SMTP ✔ Enter the SMTP host: · smtp.gmail.com ✔ Which security protocol do you want to use? · SSL/TLS ✔ Enter the SMTP port: · 465 ✔ Enter your SMTP login: · djhaskin987@gmail.com ✔ What would you like to name your account? · gmail Writing the configuration to "/home/soywod/config.wizard.toml"... Error: Permission denied (os error 13)
Comment by ~skin on ~soywod/pimalaya
Note,
cargo install --all-features --path .
DOES work, as long as I install thenotmuch
library first. This error is on linux.
Ticket created by ~skin on ~soywod/pimalaya
Errors are below.
warning: unused import: `Context`====> ] 431/436: himalaya, zbus, secret-service, pimalaya-email --> src/config/config.rs:6:22 | 6 | use anyhow::{anyhow, Context, Result}; | ^^^^^^^ | = note: `#[warn(unused_imports)]` on by default warning: unused import: `fs` --> src/config/config.rs:12:33 | 12 | use std::{collections::HashMap, fs, path::PathBuf}; | ^^ warning: unused import: `toml` --> src/config/config.rs:13:5 | 13 | use toml; | ^^^^ warning: unused imports: `CMD`, `KEYRING` --> src/config/wizard/imap.rs:7:30 | 7 | use super::{AUTH_MECHANISMS, CMD, KEYRING, RAW, SECRET, SECURITY_PROTOCOLS, THEME}; | ^^^ ^^^^^^^ warning: unused import: `anyhow` --> src/config/wizard/mod.rs:12:14 | 12 | use anyhow::{anyhow, Result}; | ^^^^^^ error[E0433]: failed to resolve: use of undeclared crate or module `notmuch` --> src/config/wizard/mod.rs:148:52 | 148 | Some(idx) if BACKENDS[idx] == "Notmuch" => notmuch::configure(), | ^^^^^^^ use of undeclared crate or module `notmuch` For more information about this error, try `rustc --explain E0433`.