2023-02-21 17:47:21 +01:00
|
|
|
package ui
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
"runtime"
|
|
|
|
|
|
|
|
"github.com/gen2brain/beeep"
|
2023-02-21 20:11:40 +01:00
|
|
|
"github.com/ncruces/zenity"
|
2023-02-21 17:47:21 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
type UI struct {
|
2023-05-26 17:21:39 +02:00
|
|
|
ctx context.Context
|
|
|
|
progressBars map[uint]zenity.ProgressDialog
|
2023-02-21 17:47:21 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
func New() *UI {
|
2023-05-26 17:21:39 +02:00
|
|
|
return &UI{
|
|
|
|
progressBars: make(map[uint]zenity.ProgressDialog),
|
|
|
|
}
|
2023-02-21 17:47:21 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
func (u *UI) Startup(ctx context.Context) {
|
|
|
|
u.ctx = ctx
|
|
|
|
}
|
|
|
|
|
|
|
|
func (u *UI) Beep() {
|
|
|
|
if runtime.GOOS == "windows" {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
beeep.Beep(beeep.DefaultFreq, beeep.DefaultDuration)
|
|
|
|
}
|