Add system diff display
- change font to Go Regular for more characters - Update deps
This commit is contained in:
parent
04dfd6b23e
commit
249015115c
1
.gitignore
vendored
1
.gitignore
vendored
@ -2,3 +2,4 @@
|
|||||||
*.bak
|
*.bak
|
||||||
result
|
result
|
||||||
xintray
|
xintray
|
||||||
|
tags
|
||||||
|
12
Go-Regular.go
Normal file
12
Go-Regular.go
Normal file
File diff suppressed because one or more lines are too long
@ -16,11 +16,11 @@
|
|||||||
in {
|
in {
|
||||||
xintray = pkgs.buildGo120Module {
|
xintray = pkgs.buildGo120Module {
|
||||||
pname = "xintray";
|
pname = "xintray";
|
||||||
version = "v0.1.12";
|
version = "v0.1.13";
|
||||||
src = ./.;
|
src = ./.;
|
||||||
|
|
||||||
vendorHash =
|
vendorHash =
|
||||||
"sha256-+jVpoEJERT+RSNRLDKw3nu7ksQe555p9ZPaDx3lDH50=";
|
"sha256-mp9e0Ed2bvyyqbQgnmWhS1Tb341iW8bJdlxNcjTG4Vo=";
|
||||||
proxyVendor = true;
|
proxyVendor = true;
|
||||||
|
|
||||||
nativeBuildInputs = with pkgs; [ pkg-config ];
|
nativeBuildInputs = with pkgs; [ pkg-config ];
|
||||||
@ -65,6 +65,8 @@
|
|||||||
xorg.libXrandr
|
xorg.libXrandr
|
||||||
xorg.libXxf86vm
|
xorg.libXxf86vm
|
||||||
xorg.xinput
|
xorg.xinput
|
||||||
|
|
||||||
|
go-font
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
10
go.mod
10
go.mod
@ -3,13 +3,13 @@ module suah.dev/xintray
|
|||||||
go 1.17
|
go 1.17
|
||||||
|
|
||||||
require (
|
require (
|
||||||
fyne.io/fyne/v2 v2.3.4
|
fyne.io/fyne/v2 v2.3.5
|
||||||
golang.org/x/crypto v0.8.0
|
golang.org/x/crypto v0.9.0
|
||||||
golang.org/x/net v0.9.0
|
golang.org/x/net v0.10.0
|
||||||
)
|
)
|
||||||
|
|
||||||
require (
|
require (
|
||||||
fyne.io/systray v1.10.1-0.20230403195833-7dc3c09283d6 // indirect
|
fyne.io/systray v1.10.1-0.20230602210930-b6a2d6ca2a7b // indirect
|
||||||
github.com/davecgh/go-spew v1.1.1 // indirect
|
github.com/davecgh/go-spew v1.1.1 // indirect
|
||||||
github.com/fredbi/uri v1.0.0 // indirect
|
github.com/fredbi/uri v1.0.0 // indirect
|
||||||
github.com/fsnotify/fsnotify v1.6.0 // indirect
|
github.com/fsnotify/fsnotify v1.6.0 // indirect
|
||||||
@ -31,7 +31,7 @@ require (
|
|||||||
github.com/yuin/goldmark v1.5.3 // indirect
|
github.com/yuin/goldmark v1.5.3 // indirect
|
||||||
golang.org/x/image v0.7.0 // indirect
|
golang.org/x/image v0.7.0 // indirect
|
||||||
golang.org/x/mobile v0.0.0-20221110043201-43a038452099 // indirect
|
golang.org/x/mobile v0.0.0-20221110043201-43a038452099 // indirect
|
||||||
golang.org/x/sys v0.7.0 // indirect
|
golang.org/x/sys v0.8.0 // indirect
|
||||||
golang.org/x/text v0.9.0 // indirect
|
golang.org/x/text v0.9.0 // indirect
|
||||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||||
honnef.co/go/js/dom v0.0.0-20221001195520-26252dedbe70 // indirect
|
honnef.co/go/js/dom v0.0.0-20221001195520-26252dedbe70 // indirect
|
||||||
|
24
go.sum
24
go.sum
@ -37,10 +37,10 @@ cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohl
|
|||||||
cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs=
|
cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs=
|
||||||
cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0=
|
cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0=
|
||||||
dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
|
dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
|
||||||
fyne.io/fyne/v2 v2.3.4 h1:CL8LBUoct2K3EF7Q7NdcDrDMcb3OrNJTghLYTFF400Q=
|
fyne.io/fyne/v2 v2.3.5 h1:Q8WOtsms+esLrBKJGdj6P+klu+UXzRq63uPxFSQm4nc=
|
||||||
fyne.io/fyne/v2 v2.3.4/go.mod h1:X2+NrR+62mvAiAt2fwKT7035zQsE77KVV1NlvWo4vW8=
|
fyne.io/fyne/v2 v2.3.5/go.mod h1:fbrL+kwOQ6sdVhnURktTHIRIEXwysQSLeejyFyABmNI=
|
||||||
fyne.io/systray v1.10.1-0.20230403195833-7dc3c09283d6 h1:lHt8dm97Uy9ggtnt9N6XOlsp76wXmRAh3SjReWm1e2Q=
|
fyne.io/systray v1.10.1-0.20230602210930-b6a2d6ca2a7b h1:MP1cUnIdF1cxrMhK9iw9H0JP3zopyD1zi84BqU6WTsE=
|
||||||
fyne.io/systray v1.10.1-0.20230403195833-7dc3c09283d6/go.mod h1:oM2AQqGJ1AMo4nNqZFYU8xYygSBZkW2hmdJ7n4yjedE=
|
fyne.io/systray v1.10.1-0.20230602210930-b6a2d6ca2a7b/go.mod h1:oM2AQqGJ1AMo4nNqZFYU8xYygSBZkW2hmdJ7n4yjedE=
|
||||||
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
|
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
|
||||||
github.com/BurntSushi/toml v1.1.0/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ=
|
github.com/BurntSushi/toml v1.1.0/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ=
|
||||||
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
|
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
|
||||||
@ -321,8 +321,8 @@ golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8U
|
|||||||
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
||||||
golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
|
golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
|
||||||
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
|
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
|
||||||
golang.org/x/crypto v0.8.0 h1:pd9TJtTueMTVQXzk8E2XESSMQDj/U7OUu0PqJqPXQjQ=
|
golang.org/x/crypto v0.9.0 h1:LF6fAI+IutBocDJ2OT0Q1g8plpYljMZ4+lty+dsqw3g=
|
||||||
golang.org/x/crypto v0.8.0/go.mod h1:mRqEX+O9/h5TFCrQhkgjo2yKi0yYA+9ecGkdQoHrywE=
|
golang.org/x/crypto v0.9.0/go.mod h1:yrmDGqONDYtNj3tH8X9dzUun2m2lzPa9ngI6/RUPGR0=
|
||||||
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
||||||
golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
||||||
golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8=
|
golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8=
|
||||||
@ -408,8 +408,8 @@ golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d/go.mod h1:9nx3DQGgdP8bBQD5qx
|
|||||||
golang.org/x/net v0.0.0-20211118161319-6a13c67c3ce4/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
golang.org/x/net v0.0.0-20211118161319-6a13c67c3ce4/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
||||||
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
|
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
|
||||||
golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
|
golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
|
||||||
golang.org/x/net v0.9.0 h1:aWJ/m6xSmxWBx+V0XRHTlrYrPG56jKsLdTFmsSsCzOM=
|
golang.org/x/net v0.10.0 h1:X2//UzNDwYmtCLn7To6G58Wr6f5ahEAQgKNzv9Y951M=
|
||||||
golang.org/x/net v0.9.0/go.mod h1:d48xBJpPfHeWQsugry2m+kC02ZBRGRgulfHnEXEuWns=
|
golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg=
|
||||||
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
|
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
|
||||||
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
|
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
|
||||||
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
|
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
|
||||||
@ -488,13 +488,13 @@ golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBc
|
|||||||
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/sys v0.7.0 h1:3jlCCIQZPdOYu1h8BkNvLz8Kgwtae2cagcG/VamtZRU=
|
golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU=
|
||||||
golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
||||||
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
|
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
|
||||||
golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
|
golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
|
||||||
golang.org/x/term v0.7.0 h1:BEvjmm5fURWqcfbSKTdpkDXYBrUS1c0m8agp14W48vQ=
|
golang.org/x/term v0.8.0 h1:n5xxQn2i3PC0yLAbjTpNT85q/Kgzcr2gIoX9OrJUols=
|
||||||
golang.org/x/term v0.7.0/go.mod h1:P32HKFT3hSsZrRxla30E9HqToFYAQPCMs/zFMBUFqPY=
|
golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo=
|
||||||
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||||
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||||
|
50
main.go
50
main.go
@ -2,6 +2,7 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
|
"encoding/base64"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"encoding/xml"
|
"encoding/xml"
|
||||||
"fmt"
|
"fmt"
|
||||||
@ -56,6 +57,7 @@ type Status struct {
|
|||||||
NeedsRestart bool `json:"needs_restart"`
|
NeedsRestart bool `json:"needs_restart"`
|
||||||
NixosVersion string `json:"nixosVersion"`
|
NixosVersion string `json:"nixosVersion"`
|
||||||
NixpkgsRevision string `json:"nixpkgsRevision"`
|
NixpkgsRevision string `json:"nixpkgsRevision"`
|
||||||
|
SystemDiff string `json:"system_diff"`
|
||||||
Host string `json:"host"`
|
Host string `json:"host"`
|
||||||
Port int32 `json:"port"`
|
Port int32 `json:"port"`
|
||||||
}
|
}
|
||||||
@ -303,48 +305,71 @@ func (c *Config) Load(file string) error {
|
|||||||
|
|
||||||
func (s *Status) ToTable() *widget.Table {
|
func (s *Status) ToTable() *widget.Table {
|
||||||
t := widget.NewTable(
|
t := widget.NewTable(
|
||||||
|
// Length
|
||||||
func() (int, int) {
|
func() (int, int) {
|
||||||
return 4, 2
|
return 5, 2
|
||||||
},
|
},
|
||||||
|
// CreateCell
|
||||||
func() fyne.CanvasObject {
|
func() fyne.CanvasObject {
|
||||||
return widget.NewLabel("")
|
//ct := container.NewScroll(container.NewMax(widget.NewLabel("")))
|
||||||
|
ct := container.NewMax(container.NewVScroll(widget.NewLabel("")))
|
||||||
|
//ct := container.NewMax(widget.NewLabel(""))
|
||||||
|
return ct
|
||||||
},
|
},
|
||||||
|
// UpdateCell
|
||||||
func(i widget.TableCellID, o fyne.CanvasObject) {
|
func(i widget.TableCellID, o fyne.CanvasObject) {
|
||||||
|
ctnr := o.(*fyne.Container)
|
||||||
|
content := ctnr.Objects[0].(*container.Scroll).Content.(*widget.Label)
|
||||||
if i.Col == 0 {
|
if i.Col == 0 {
|
||||||
switch i.Row {
|
switch i.Row {
|
||||||
case 0:
|
case 0:
|
||||||
o.(*widget.Label).SetText("NixOS Version")
|
content.SetText("NixOS Version")
|
||||||
case 1:
|
case 1:
|
||||||
o.(*widget.Label).SetText("Nixpkgs Revision")
|
content.SetText("NixPkgs Revision")
|
||||||
case 2:
|
case 2:
|
||||||
o.(*widget.Label).SetText("Configuration Revision")
|
content.SetText("Configuration Revision")
|
||||||
case 3:
|
case 3:
|
||||||
o.(*widget.Label).SetText("Restart?")
|
content.SetText("Restart?")
|
||||||
|
case 4:
|
||||||
|
content.SetText("System Diff")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if i.Col == 1 {
|
if i.Col == 1 {
|
||||||
switch i.Row {
|
switch i.Row {
|
||||||
case 0:
|
case 0:
|
||||||
o.(*widget.Label).SetText(s.NixosVersion)
|
content.SetText(s.NixosVersion)
|
||||||
case 1:
|
case 1:
|
||||||
o.(*widget.Label).SetText(s.NixpkgsRevision)
|
content.SetText(s.NixpkgsRevision)
|
||||||
case 2:
|
case 2:
|
||||||
o.(*widget.Label).SetText(s.ConfigurationRevision)
|
content.SetText(s.ConfigurationRevision)
|
||||||
case 3:
|
case 3:
|
||||||
str := "No"
|
str := "No"
|
||||||
if s.NeedsRestart {
|
if s.NeedsRestart {
|
||||||
str = "Yes"
|
str = "Yes"
|
||||||
}
|
}
|
||||||
o.(*widget.Label).SetText(str)
|
content.SetText(str)
|
||||||
|
case 4:
|
||||||
|
text, err := base64.StdEncoding.DecodeString(s.SystemDiff)
|
||||||
|
if err != nil {
|
||||||
|
fmt.Println("decode error:", err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
content.SetText(string(text))
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
// OnSelected
|
||||||
|
// func (i widget.TableCellID) {}
|
||||||
|
// OnUnselected
|
||||||
|
// func (i widget.TableCellID) {}
|
||||||
)
|
)
|
||||||
|
|
||||||
t.Refresh()
|
t.Refresh()
|
||||||
|
|
||||||
t.SetColumnWidth(0, 200.0)
|
t.SetColumnWidth(0, 300.0)
|
||||||
t.SetColumnWidth(1, 33.0)
|
t.SetColumnWidth(1, 600.0)
|
||||||
|
t.SetRowHeight(4, 600.0)
|
||||||
|
|
||||||
return t
|
return t
|
||||||
}
|
}
|
||||||
@ -416,6 +441,7 @@ func main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
a := app.New()
|
a := app.New()
|
||||||
|
a.Settings().SetTheme(&xinTheme{})
|
||||||
w := a.NewWindow("xintray")
|
w := a.NewWindow("xintray")
|
||||||
|
|
||||||
ctrlQ := &desktop.CustomShortcut{KeyName: fyne.KeyQ, Modifier: fyne.KeyModifierControl}
|
ctrlQ := &desktop.CustomShortcut{KeyName: fyne.KeyQ, Modifier: fyne.KeyModifierControl}
|
||||||
|
38
theme.go
Normal file
38
theme.go
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"image/color"
|
||||||
|
|
||||||
|
"fyne.io/fyne/v2"
|
||||||
|
"fyne.io/fyne/v2/theme"
|
||||||
|
)
|
||||||
|
|
||||||
|
type xinTheme struct{}
|
||||||
|
|
||||||
|
func (*xinTheme) Font(s fyne.TextStyle) fyne.Resource {
|
||||||
|
if s.Monospace {
|
||||||
|
return theme.DefaultTheme().Font(s)
|
||||||
|
}
|
||||||
|
if s.Bold {
|
||||||
|
if s.Italic {
|
||||||
|
return theme.DefaultTheme().Font(s)
|
||||||
|
}
|
||||||
|
return resourceGoRegularTtf
|
||||||
|
}
|
||||||
|
if s.Italic {
|
||||||
|
return theme.DefaultTheme().Font(s)
|
||||||
|
}
|
||||||
|
return resourceGoRegularTtf
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*xinTheme) Color(n fyne.ThemeColorName, v fyne.ThemeVariant) color.Color {
|
||||||
|
return theme.DefaultTheme().Color(n, v)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*xinTheme) Icon(n fyne.ThemeIconName) fyne.Resource {
|
||||||
|
return theme.DefaultTheme().Icon(n)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*xinTheme) Size(n fyne.ThemeSizeName) float32 {
|
||||||
|
return theme.DefaultTheme().Size(n)
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user