Skip to content

Commit

Permalink
add: icon switch demo fix: systray.SetIcon #7
Browse files Browse the repository at this point in the history
  • Loading branch information
sxmxta committed Sep 6, 2023
1 parent 19fda2c commit 8d40d95
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions example/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"io/ioutil"
"os"
"path/filepath"
"runtime"
"strings"
"time"
)
Expand Down Expand Up @@ -135,8 +136,12 @@ func onReady() {
wd = strings.Replace(wd, "example", "", -1)
wd = filepath.Join(wd, "icon")
fmt.Println("wd", wd) // /to/icon/path/icon.png, logo.png
icoData, _ := ioutil.ReadFile(filepath.Join(wd, "icon.png"))
logoData, _ := ioutil.ReadFile(filepath.Join(wd, "logo.png"))
var ext = ".png"
if runtime.GOOS == "windows" {
ext = ".ico" // windows .ico
}
icoData, _ := ioutil.ReadFile(filepath.Join(wd, "icon"+ext))
logoData, _ := ioutil.ReadFile(filepath.Join(wd, "logo"+ext))
for true {
time.Sleep(time.Second * 1)
b = !b
Expand Down
Binary file added icon/icon.ico
Binary file not shown.
Binary file added icon/logo.ico
Binary file not shown.

0 comments on commit 8d40d95

Please sign in to comment.