Sebastian Mark
4dcc984784
- add keyboard listener for space, r, and q keys
- create shared state for server messages
- update desktop and terminal notifications to use shared state
🤖
39 lines
713 B
Go
39 lines
713 B
Go
package notifications
|
|
|
|
import (
|
|
"ChronoTomato/internal/shared"
|
|
"fmt"
|
|
)
|
|
|
|
func TerminalOutput() {
|
|
var timerOutput string
|
|
|
|
msg := &shared.ServerMessage
|
|
|
|
fmt.Print("\033[H\033[2J") // Clears the screen
|
|
|
|
fmt.Printf("Work: %d | Break: %d | Longbreak: %d\n",
|
|
msg.PomodoroSettings.Work/60,
|
|
msg.PomodoroSettings.ShortBreak/60,
|
|
msg.PomodoroSettings.LongBreak/60,
|
|
)
|
|
fmt.Printf("Session: %d/%d\n",
|
|
msg.Session,
|
|
msg.PomodoroSettings.Sessions,
|
|
)
|
|
fmt.Printf("\n▶ %s\n",
|
|
msg.Mode,
|
|
)
|
|
|
|
switch msg.Mode {
|
|
case "Idle":
|
|
timerOutput = ""
|
|
default:
|
|
minutes := msg.TimeLeft / 60
|
|
seconds := msg.TimeLeft % 60
|
|
|
|
timerOutput = fmt.Sprintf("⏳ %02d:%02d", minutes, seconds)
|
|
}
|
|
|
|
fmt.Printf(timerOutput)
|
|
}
|