From 70623bff625d9f937d6d6d8458eb7dfca796a11c Mon Sep 17 00:00:00 2001 From: Mike Vink Date: Mon, 10 Jun 2024 20:33:17 +0200 Subject: pomodoro fix --- machines/lemptop.nix | 1 + mut/bin/sb-pomodoro | 3 +++ 2 files changed, 4 insertions(+) diff --git a/machines/lemptop.nix b/machines/lemptop.nix index fb05a3d..a3e0781 100644 --- a/machines/lemptop.nix +++ b/machines/lemptop.nix @@ -61,6 +61,7 @@ with lib; ''; virtualisation.docker.enable = true; + programs.nix-ld.enable = true; sound.enable = false; hardware.pulseaudio.enable = false; diff --git a/mut/bin/sb-pomodoro b/mut/bin/sb-pomodoro index 8d4fc69..1eb222a 100755 --- a/mut/bin/sb-pomodoro +++ b/mut/bin/sb-pomodoro @@ -26,6 +26,9 @@ if [ -z "$status" ]; then if [ "$daily_completed" -ne "0" ]; then seconds_since_last_started="$(( $(date +%s -u) - $(tail -n1 ~/.pomodoro/history | cut -f1 -d' ' | xargs -I{} date -d"{}" +%s -u) ))" seconds_since_last="$(( "$seconds_since_last_started" - 60*$(tail -n1 ~/.pomodoro/history | cut -f2 -d' ' | cut -f2 -d'=')))" + if [ "$seconds_since_last" -lt 0 ]; then + seconds_since_last=0 + fi msg="$(date -d@"$seconds_since_last" +"%H:%M" -u)min ago $msg" fi echo "$msg" -- cgit v1.2.3