diff --git a/timefor.go b/timefor.go index 76f060b..d383b19 100644 --- a/timefor.go +++ b/timefor.go @@ -540,6 +540,9 @@ func Daemon( select { case c := <-change: log.Println("change", c) + if c.Error != nil { + return c.Error + } case <-time.After(nextUpdate): if activity.Active() && time.Since(activity.Updated()) > time.Minute { @@ -680,14 +683,6 @@ func Report(db *sqlx.DB) (title, desc string, err error) { return title, buf.String(), nil } -func formatDuration(d time.Duration) string { - d = d.Truncate(time.Minute) - h := d / time.Hour - d -= h * time.Hour - m := d / time.Minute - return fmt.Sprintf("%02d:%02d", h, m) -} - // Select selects new activity using rofi menu func Select(db *sqlx.DB) (string, error) { var names []string @@ -726,6 +721,14 @@ func Select(db *sqlx.DB) (string, error) { return string(selectedName), nil } +func formatDuration(d time.Duration) string { + d = d.Truncate(time.Minute) + h := d / time.Hour + d -= h * time.Hour + m := d / time.Minute + return fmt.Sprintf("%02d:%02d", h, m) +} + // Activity represents a named activity type Activity struct { ID int64