Compare commits

..

2 commits

Author SHA1 Message Date
0f8fde3143 fix: update GoTomato model field names
adjust field names due to breaking changes in GoTomato v0.0.4
2024-10-28 07:56:37 +01:00
2430e22756 fix: update module git.smsvc.net/pomodoro/gotomato to v0.0.4 2024-10-28 06:53:51 +00:00
7 changed files with 19 additions and 19 deletions

2
go.mod
View file

@ -5,7 +5,7 @@ go 1.23.1
require ( require (
atomicgo.dev/cursor v0.2.0 atomicgo.dev/cursor v0.2.0
atomicgo.dev/keyboard v0.2.9 atomicgo.dev/keyboard v0.2.9
git.smsvc.net/pomodoro/GoTomato v0.0.3 git.smsvc.net/pomodoro/GoTomato v0.0.4
github.com/charmbracelet/log v0.4.0 github.com/charmbracelet/log v0.4.0
github.com/fatih/color v1.18.0 github.com/fatih/color v1.18.0
github.com/gen2brain/beeep v0.0.0-20240516210008-9c006672e7f4 github.com/gen2brain/beeep v0.0.0-20240516210008-9c006672e7f4

4
go.sum
View file

@ -2,8 +2,8 @@ atomicgo.dev/cursor v0.2.0 h1:H6XN5alUJ52FZZUkI7AlJbUc1aW38GWZalpYRPpoPOw=
atomicgo.dev/cursor v0.2.0/go.mod h1:Lr4ZJB3U7DfPPOkbH7/6TOtJ4vFGHlgj1nc+n900IpU= atomicgo.dev/cursor v0.2.0/go.mod h1:Lr4ZJB3U7DfPPOkbH7/6TOtJ4vFGHlgj1nc+n900IpU=
atomicgo.dev/keyboard v0.2.9 h1:tOsIid3nlPLZ3lwgG8KZMp/SFmr7P0ssEN5JUsm78K8= atomicgo.dev/keyboard v0.2.9 h1:tOsIid3nlPLZ3lwgG8KZMp/SFmr7P0ssEN5JUsm78K8=
atomicgo.dev/keyboard v0.2.9/go.mod h1:BC4w9g00XkxH/f1HXhW2sXmJFOCWbKn9xrOunSFtExQ= atomicgo.dev/keyboard v0.2.9/go.mod h1:BC4w9g00XkxH/f1HXhW2sXmJFOCWbKn9xrOunSFtExQ=
git.smsvc.net/pomodoro/GoTomato v0.0.3 h1:9tYd26YM52CT1g/eNFrc14sSrGQUELuIVh6KT91DpII= git.smsvc.net/pomodoro/GoTomato v0.0.4 h1:+pCbPXUMtPteQilMe3QNo6fl67kB9gO6C/g0sNj1zck=
git.smsvc.net/pomodoro/GoTomato v0.0.3/go.mod h1:TV6+3bYjwc+kJ7I60H9YSd7BdBBzPnisx/MRnBbEeDk= git.smsvc.net/pomodoro/GoTomato v0.0.4/go.mod h1:rNFUjjBMKplygWYbgErWd4cD8JQ66h0KyiK54cGktJo=
github.com/MarvinJWendt/testza v0.1.0/go.mod h1:7AxNvlfeHP7Z/hDQ5JtE3OKYT3XFUeLCDE2DQninSqs= github.com/MarvinJWendt/testza v0.1.0/go.mod h1:7AxNvlfeHP7Z/hDQ5JtE3OKYT3XFUeLCDE2DQninSqs=
github.com/MarvinJWendt/testza v0.2.1/go.mod h1:God7bhG8n6uQxwdScay+gjm9/LnO4D3kkcZX4hv9Rp8= github.com/MarvinJWendt/testza v0.2.1/go.mod h1:God7bhG8n6uQxwdScay+gjm9/LnO4D3kkcZX4hv9Rp8=
github.com/MarvinJWendt/testza v0.2.8/go.mod h1:nwIcjmr0Zz+Rcwfh3/4UhBp7ePKVhuBExvZqnKYWlII= github.com/MarvinJWendt/testza v0.2.8/go.mod h1:nwIcjmr0Zz+Rcwfh3/4UhBp7ePKVhuBExvZqnKYWlII=

View file

@ -36,7 +36,7 @@ func keyhandler(conn *ws.Conn, config ChronoTomato.Config, message *GoTomato.Ser
case "s": case "s":
websocket.SendCmd(conn, config.Password, "stop") websocket.SendCmd(conn, config.Password, "stop")
case "r": case "r":
if config.PomodoroConfig != (GoTomato.GoTomatoPomodoroConfig{}) { if config.PomodoroConfig != (GoTomato.PomodoroConfig{}) {
websocket.Send_updateSettings(conn, config.Password, config.PomodoroConfig) websocket.Send_updateSettings(conn, config.Password, config.PomodoroConfig)
} }
case "q": case "q":

View file

@ -16,17 +16,17 @@ func desktopNotifications(pomodoro GoTomato.ServerMessage) {
mode := pomodoro.Mode mode := pomodoro.Mode
session := pomodoro.Session session := pomodoro.Session
sessions := pomodoro.PomodoroSettings.Sessions sessions := pomodoro.Settings.Sessions
switch mode { switch mode {
case "Work": case "Work":
duration = pomodoro.PomodoroSettings.Work duration = pomodoro.Settings.Work
notification = fmt.Sprintf("Session %d/%d: %s %0.f minutes", session, sessions, mode, float32(duration)/60) notification = fmt.Sprintf("Session %d/%d: %s %0.f minutes", session, sessions, mode, float32(duration)/60)
case "ShortBreak": case "ShortBreak":
duration = pomodoro.PomodoroSettings.ShortBreak duration = pomodoro.Settings.ShortBreak
notification = fmt.Sprintf("Session %d/%d: Take a %0.f minute break", session, sessions, float32(duration)/60) notification = fmt.Sprintf("Session %d/%d: Take a %0.f minute break", session, sessions, float32(duration)/60)
case "LongBreak": case "LongBreak":
duration = pomodoro.PomodoroSettings.LongBreak duration = pomodoro.Settings.LongBreak
notification = fmt.Sprintf("Long Break: Take a %0.f minute break", float32(duration)/60) notification = fmt.Sprintf("Long Break: Take a %0.f minute break", float32(duration)/60)
case "End": case "End":
duration = 0 duration = 0

View file

@ -18,9 +18,9 @@ func terminalOutput(pomodoro GoTomato.ServerMessage) {
// header // header
color.Blue("Work: %d ◊ Break: %d ◊ Longbreak: %d\n\n", color.Blue("Work: %d ◊ Break: %d ◊ Longbreak: %d\n\n",
pomodoro.PomodoroSettings.Work/60, pomodoro.Settings.Work/60,
pomodoro.PomodoroSettings.ShortBreak/60, pomodoro.Settings.ShortBreak/60,
pomodoro.PomodoroSettings.LongBreak/60, pomodoro.Settings.LongBreak/60,
) )
//body //body
@ -41,7 +41,7 @@ func terminalOutput(pomodoro GoTomato.ServerMessage) {
fmt.Printf("Session: %d/%d\n", fmt.Printf("Session: %d/%d\n",
pomodoro.Session, pomodoro.Session,
pomodoro.PomodoroSettings.Sessions, pomodoro.Settings.Sessions,
) )
fmt.Printf("%s %s\n", modePrefix, pomodoro.Mode) fmt.Printf("%s %s\n", modePrefix, pomodoro.Mode)
fmt.Printf(timerOutput) fmt.Printf(timerOutput)

View file

@ -31,11 +31,11 @@ func SendCmd(conn *websocket.Conn, pwd string, cmd string) {
sendClientCommand(conn, message) sendClientCommand(conn, message)
} }
func Send_updateSettings(conn *websocket.Conn, pwd string, settings GoTomato.GoTomatoPomodoroConfig) { func Send_updateSettings(conn *websocket.Conn, pwd string, settings GoTomato.PomodoroConfig) {
message := GoTomato.ClientCommand{ message := GoTomato.ClientCommand{
Command: "updateSettings", Command: "updateSettings",
Password: pwd, Password: pwd,
PomodoroSettings: settings, Settings: settings,
} }
sendClientCommand(conn, message) sendClientCommand(conn, message)

View file

@ -5,5 +5,5 @@ import GoTomato "git.smsvc.net/pomodoro/GoTomato/pkg/models"
type Config struct { type Config struct {
URL string `yaml:"url"` URL string `yaml:"url"`
Password string `yaml:"password"` Password string `yaml:"password"`
PomodoroConfig GoTomato.GoTomatoPomodoroConfig `yaml:"config"` PomodoroConfig GoTomato.PomodoroConfig `yaml:"config"`
} }