2023-12-26 16:03:45 -08:00
|
|
|
package tray
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"runtime"
|
|
|
|
|
2024-03-26 13:04:17 -07:00
|
|
|
"github.com/ollama/ollama/app/assets"
|
|
|
|
"github.com/ollama/ollama/app/tray/commontray"
|
2023-12-26 16:03:45 -08:00
|
|
|
)
|
|
|
|
|
|
|
|
func NewTray() (commontray.OllamaTray, error) {
|
|
|
|
extension := ".png"
|
|
|
|
if runtime.GOOS == "windows" {
|
|
|
|
extension = ".ico"
|
|
|
|
}
|
|
|
|
iconName := commontray.UpdateIconName + extension
|
|
|
|
updateIcon, err := assets.GetIcon(iconName)
|
|
|
|
if err != nil {
|
|
|
|
return nil, fmt.Errorf("failed to load icon %s: %w", iconName, err)
|
|
|
|
}
|
|
|
|
iconName = commontray.IconName + extension
|
|
|
|
icon, err := assets.GetIcon(iconName)
|
|
|
|
if err != nil {
|
|
|
|
return nil, fmt.Errorf("failed to load icon %s: %w", iconName, err)
|
|
|
|
}
|
|
|
|
|
2024-04-10 11:26:15 -07:00
|
|
|
return InitPlatformTray(icon, updateIcon)
|
2023-12-26 16:03:45 -08:00
|
|
|
}
|