package frontend import ( "github.com/eiannone/keyboard" ws "github.com/gorilla/websocket" "git.smsvc.net/pomodoro/ChronoTomato/internal/websocket" ChronoTomato "git.smsvc.net/pomodoro/ChronoTomato/pkg/models" GoTomato "git.smsvc.net/pomodoro/GoTomato/pkg/models" ) func UpdateLoop(conn *ws.Conn, config ChronoTomato.Config, channel <-chan GoTomato.ServerMessage) { var message GoTomato.ServerMessage keysEvents, _ := keyboard.GetKeys(1) defer keyboard.Close() for { select { case message = <-channel: desktopNotifications(message) terminalOutput(message) case keypress := <-keysEvents: if !keyhandler(keypress, conn, config, message) { return } case <-websocket.Done: return } } }