kevinschoon-pomo/types.go

59 lines
1.1 KiB
Go
Raw Normal View History

2018-01-16 10:50:08 +01:00
package main
import (
"os/exec"
"time"
)
2018-01-20 13:03:23 +01:00
// RefreshInterval is the frequency at which
// the display is updated.
const RefreshInterval = 800 * time.Millisecond
// Message is used internally for updating
// the display.
type Message struct {
Start time.Time
Duration time.Duration
Stents int
CurrentStent int
}
2018-01-16 10:50:08 +01:00
// Task describes some activity
type Task struct {
2018-01-20 11:01:53 +01:00
ID int `json:"id"`
Message string `json:"message"`
Records []*Record `json:"records"`
// Free-form tags associated with this task
2018-01-20 13:03:23 +01:00
Tags []string `json:"tags"`
// Number of iterations to perform the task
stents int
2018-01-16 10:50:08 +01:00
duration time.Duration
}
2018-01-16 12:06:20 +01:00
// Record is a stetch of work performed on a
2018-01-16 10:50:08 +01:00
// specific task.
2018-01-16 12:06:20 +01:00
type Record struct {
2018-01-16 13:02:35 +01:00
Start time.Time `json:"start"`
End time.Time `json:"end"`
2018-01-16 10:50:08 +01:00
}
// Prompter prompts a user with a message.
type Prompter interface {
Prompt(string) error
}
// I3 implements a prompter for i3
type I3 struct{}
func (i *I3) Prompt(message string) error {
2018-01-20 10:39:05 +01:00
_, err := exec.Command(
2018-01-16 10:50:08 +01:00
"/bin/i3-nagbar",
"-m",
message,
).Output()
if err != nil {
return err
}
return nil
}