Skip to content

Commit

Permalink
加入icon
Browse files Browse the repository at this point in the history
  • Loading branch information
aveyuan committed Mar 7, 2020
1 parent b791c11 commit abcc22e
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# app-gui
Linux上APP快速启动GUI工具

项目地址:https://github.com/aveyuan/app-gui
### 开发背景
>在Linux中,可执行的文件和脚本文件总是会打开一个终端,当终端关闭的时候,执行的文件也就关闭了。
你为此苦恼不已,然后你添加到桌面图标,尝试过添加到服务进行管理,用一些类似于Supervisor的管理软件,但得不偿失。你渴望找到一个以后台(daemon)运行的方式,
Expand Down
Binary file added icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package main

import (
"fmt"
"io/ioutil"
"log"
"os"
"os/exec"
Expand All @@ -20,6 +21,15 @@ func main() {
_ = os.Setenv("FYNE_FONT", "./miniHei.ttf")
app := app.New()
w := app.NewWindow("App")
f, err := os.Open("./icon.png")
bit, _ := ioutil.ReadAll(f)
if err == nil {
w.SetIcon(&fyne.StaticResource{
StaticName: "ico,ico",
StaticContent:bit ,
})
}

w.SetContent(widget.NewVBox(
Mbox()...,
),
Expand Down

0 comments on commit abcc22e

Please sign in to comment.