mirror of
https://gitee.com/energye/energy.git
synced 2024-11-30 10:47:57 +08:00
v2.3.63 darwin notice
This commit is contained in:
parent
6b2fd16619
commit
261dbd4dd0
@ -91,10 +91,15 @@ func (m *SysTray) AsLCLTray() *LCLTray {
|
||||
func (m *SysTray) Show() {
|
||||
m.once.Do(func() {
|
||||
if m.start == nil {
|
||||
go func() {
|
||||
var runLoop = func() {
|
||||
m.start, m.stop = systray.RunWithExternalLoop(m.onReady, m.onExit)
|
||||
m.start()
|
||||
}()
|
||||
}
|
||||
if common.IsDarwin() {
|
||||
runLoop()
|
||||
} else {
|
||||
go runLoop()
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
@ -140,7 +140,7 @@ func sysTray(browserWindow cef.IBrowserWindow) {
|
||||
check.Check()
|
||||
} else {
|
||||
sysTray.SetHint(fmt.Sprintf("%d\n%v", time.Now().Second(), b))
|
||||
sysTray.SetIconFS("resources/icon.ico")
|
||||
sysTray.SetIconFS("resources/icon.png")
|
||||
menuItem.SetIconFS("resources/icon.ico")
|
||||
enable.SetLabel(fmt.Sprintf("%d\n%v", time.Now().Second(), b))
|
||||
enable.Disable()
|
||||
|
@ -10,7 +10,6 @@ package main
|
||||
|
||||
import (
|
||||
"embed"
|
||||
"energye/notice"
|
||||
"fmt"
|
||||
"github.com/energye/energy/cef"
|
||||
"github.com/energye/energy/common"
|
||||
@ -72,7 +71,7 @@ func main() {
|
||||
//设置隐藏窗口标题
|
||||
//window.HideTitle()
|
||||
fmt.Println("SetBrowserInitAfter 结束")
|
||||
sysTray(window)
|
||||
//sysTray(window)
|
||||
})
|
||||
//在主进程启动成功之后执行
|
||||
//在这里启动内置http服务
|
||||
@ -102,7 +101,7 @@ func sysTray(browserWindow cef.IBrowserWindow) {
|
||||
check.Check()
|
||||
not := tray.AddMenuItem("通知")
|
||||
not.Click(func() {
|
||||
notice.SendNotification(notice.NewNotification("标题", "内容").SetIconFS("resources/icon.png"))
|
||||
//notice.SendNotification(notice.NewNotification("标题", "内容").SetIconFS("resources/icon.png"))
|
||||
})
|
||||
enable := tray.AddMenuItem("启用/禁用")
|
||||
enable.Click(func() {
|
||||
|
6
vendor/energye/notice/noteic_notlegacy_darwin.go
vendored
Executable file
6
vendor/energye/notice/noteic_notlegacy_darwin.go
vendored
Executable file
@ -0,0 +1,6 @@
|
||||
package notice
|
||||
|
||||
/*
|
||||
#cgo LDFLAGS: -framework Foundation -framework UserNotifications
|
||||
*/
|
||||
import "C"
|
4
vendor/energye/notice/notice_darwin.go
vendored
4
vendor/energye/notice/notice_darwin.go
vendored
@ -1,3 +1,6 @@
|
||||
//go:build darwin
|
||||
// +build darwin
|
||||
|
||||
package notice
|
||||
|
||||
/*
|
||||
@ -15,6 +18,7 @@ import (
|
||||
"fmt"
|
||||
"golang.org/x/sys/execabs"
|
||||
"strings"
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
func SendNotification(n *Notification) {
|
||||
|
Loading…
Reference in New Issue
Block a user