diff --git a/.gitignore b/.gitignore index 007cacf..06bc2c0 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,2 @@ -icons/make_icon.sh -Eye-Reminder +icons/make_icon.sh +Eye-Reminder diff --git a/assets/Eye-Reminder-Icon.png b/assets/Eye-Reminder-Icon.png new file mode 100644 index 0000000..f1c1c95 Binary files /dev/null and b/assets/Eye-Reminder-Icon.png differ diff --git a/go.mod b/go.mod index 7743e2b..ca95937 100644 --- a/go.mod +++ b/go.mod @@ -13,6 +13,7 @@ require ( fyne.io/fyne/v2 v2.4.0 // indirect fyne.io/systray v1.10.1-0.20230722100817-88df1e0ffa9a // indirect github.com/akavel/rsrc v0.10.2 // indirect + github.com/cratonica/2goarray v0.0.0-20190331194516-514510793eaa // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/dchest/jsmin v0.0.0-20220218165748-59f39799265f // indirect github.com/fredbi/uri v1.0.0 // indirect @@ -53,10 +54,12 @@ require ( go.opentelemetry.io/otel/trace v1.19.0 // indirect go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.26.0 // indirect + golang.org/x/crypto v0.12.0 // indirect golang.org/x/image v0.11.0 // indirect golang.org/x/mobile v0.0.0-20230531173138-3c911d8e3eda // indirect golang.org/x/net v0.14.0 // indirect golang.org/x/sys v0.13.0 // indirect + golang.org/x/term v0.11.0 // indirect golang.org/x/text v0.12.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect honnef.co/go/js/dom v0.0.0-20210725211120-f030747120f2 // indirect diff --git a/go.sum b/go.sum index feadd98..2e3c6a0 100644 --- a/go.sum +++ b/go.sum @@ -63,6 +63,8 @@ github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnht github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= github.com/coreos/go-systemd/v22 v22.3.2/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= +github.com/cratonica/2goarray v0.0.0-20190331194516-514510793eaa h1:Wg+722vs7a2zQH5lR9QWYsVbplKeffaQFIs5FTdfNNo= +github.com/cratonica/2goarray v0.0.0-20190331194516-514510793eaa/go.mod h1:6Arca19mRx58CA7OWEd7Wu1NpC1rd3uDnNs6s1pj/DI= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= @@ -371,6 +373,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-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.12.0 h1:tFM/ta59kqch6LlvYnPa0yx5a83cL2nHflFhYKvv9Yk= +golang.org/x/crypto v0.12.0/go.mod h1:NF0Gs7EO5K4qLn+Ylc+fih8BSTeIjAP05siRnAh98yw= 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-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= @@ -539,6 +543,8 @@ golang.org/x/sys v0.13.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-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.11.0 h1:F9tnn/DA/Im8nCwm+fX+1/eBwi4qFjRT++MhtVC4ZX0= +golang.org/x/term v0.11.0/go.mod h1:zC9APTIj3jG3FdV/Ons+XE1riIZXG4aZ4GTHiPZJPIU= 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.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= diff --git a/icons/disabledicon/disabledicon.ico b/icons/disabledicon/disabledicon.ico new file mode 100644 index 0000000..156ca44 Binary files /dev/null and b/icons/disabledicon/disabledicon.ico differ diff --git a/icons/disabledicon/disabledicon.go b/icons/disabledicon/disabledicon_unix.go similarity index 98% rename from icons/disabledicon/disabledicon.go rename to icons/disabledicon/disabledicon_unix.go index b5f8f3e..7031760 100644 --- a/icons/disabledicon/disabledicon.go +++ b/icons/disabledicon/disabledicon_unix.go @@ -1,40 +1,40 @@ -//go:build linux || darwin -// +build linux darwin - -// File generated by 2goarray v0.1.0 (http://github.com/cratonica/2goarray) - -package disabledicon - -var Data []byte = []byte{ - 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d, - 0x49, 0x48, 0x44, 0x52, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x20, - 0x08, 0x06, 0x00, 0x00, 0x00, 0x73, 0x7a, 0x7a, 0xf4, 0x00, 0x00, 0x01, - 0x3b, 0x49, 0x44, 0x41, 0x54, 0x58, 0x85, 0xed, 0x96, 0x41, 0x1a, 0x01, - 0x31, 0x0c, 0x46, 0xff, 0xce, 0x67, 0xc1, 0xd5, 0x38, 0x06, 0x4e, 0x85, - 0x63, 0x70, 0x35, 0x76, 0xb1, 0x31, 0x91, 0xa6, 0x49, 0xda, 0x8e, 0x99, - 0xcf, 0x82, 0x7f, 0x47, 0x3b, 0x79, 0x6f, 0xaa, 0x4d, 0x01, 0xff, 0xfc, - 0xf3, 0xeb, 0x49, 0x13, 0x9f, 0xa3, 0xb9, 0xea, 0xf5, 0x3e, 0x40, 0x00, - 0x40, 0x64, 0xf3, 0x53, 0xe2, 0x72, 0xcd, 0x75, 0x5b, 0x27, 0x66, 0x60, - 0x01, 0xca, 0x27, 0x95, 0xe3, 0xd5, 0xfa, 0x2d, 0x02, 0x0c, 0x97, 0xe0, - 0xfd, 0x29, 0x5f, 0x85, 0xcb, 0xf1, 0x3d, 0xa6, 0x44, 0x42, 0x46, 0x4d, - 0x20, 0x83, 0x6b, 0xa8, 0x97, 0xcb, 0x31, 0x35, 0x4b, 0x78, 0x03, 0x4c, - 0xf2, 0xe0, 0xe3, 0x1b, 0x8f, 0xa0, 0xc3, 0xb9, 0x94, 0x90, 0xcf, 0x7b, - 0x3c, 0x4b, 0xa0, 0xf8, 0xbd, 0x25, 0x5c, 0x2e, 0xb5, 0x9c, 0x37, 0x46, - 0x8a, 0x18, 0x2b, 0x51, 0x30, 0x07, 0x05, 0x0e, 0x77, 0xb9, 0x86, 0x5b, - 0x39, 0x1f, 0xec, 0xef, 0x45, 0x4d, 0xe6, 0x48, 0x01, 0x06, 0x7b, 0x70, - 0x2f, 0xde, 0x89, 0xf0, 0x24, 0x94, 0x08, 0x06, 0x54, 0xde, 0xba, 0x57, - 0xa2, 0x45, 0x48, 0x4a, 0xac, 0x26, 0x53, 0x03, 0x89, 0x9e, 0x0c, 0x78, - 0x6d, 0x8a, 0xa9, 0x05, 0xa6, 0x44, 0x6e, 0xc8, 0x71, 0x0f, 0xb0, 0x44, - 0x24, 0xd2, 0xda, 0x07, 0x22, 0xb0, 0x3e, 0x0d, 0xf2, 0x14, 0x24, 0x2c, - 0xb8, 0x1a, 0x0a, 0x5c, 0xed, 0xd5, 0x61, 0x2f, 0x00, 0xec, 0x23, 0xa9, - 0xfb, 0x45, 0xcb, 0xdd, 0x50, 0x6d, 0xc5, 0x91, 0x84, 0x97, 0x4f, 0x5b, - 0x31, 0xa9, 0x71, 0xb2, 0x6e, 0xc1, 0xa5, 0x2e, 0x23, 0xc2, 0xf5, 0xfe, - 0xfe, 0xb4, 0xdb, 0xb0, 0x84, 0x2c, 0xac, 0x65, 0x82, 0xb1, 0xae, 0xeb, - 0x38, 0x87, 0x97, 0x12, 0xb0, 0x44, 0xb2, 0x62, 0x1f, 0xfc, 0x21, 0xb1, - 0xe1, 0xb6, 0x04, 0x8b, 0x04, 0xf5, 0x9a, 0x93, 0xaa, 0x70, 0x5f, 0x62, - 0x96, 0x0c, 0x00, 0x40, 0xdb, 0xf5, 0xdc, 0x75, 0xfb, 0x04, 0xd2, 0xed, - 0xf1, 0x35, 0x09, 0xee, 0x84, 0xdf, 0x92, 0x28, 0x36, 0x21, 0x6d, 0xd7, - 0x48, 0xb7, 0x47, 0x3e, 0x6b, 0xa1, 0xdf, 0x5f, 0x17, 0x8d, 0xda, 0xdc, - 0x62, 0x57, 0xe5, 0x13, 0x67, 0x5a, 0xaa, 0x84, 0xef, 0x3e, 0x3c, 0xfd, - 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82, -} +//go:build linux || darwin +// +build linux darwin + +// File generated by 2goarray v0.1.0 (http://github.com/cratonica/2goarray) + +package disabledicon + +var Data []byte = []byte{ + 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d, + 0x49, 0x48, 0x44, 0x52, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x20, + 0x08, 0x06, 0x00, 0x00, 0x00, 0x73, 0x7a, 0x7a, 0xf4, 0x00, 0x00, 0x01, + 0x3b, 0x49, 0x44, 0x41, 0x54, 0x58, 0x85, 0xed, 0x96, 0x41, 0x1a, 0x01, + 0x31, 0x0c, 0x46, 0xff, 0xce, 0x67, 0xc1, 0xd5, 0x38, 0x06, 0x4e, 0x85, + 0x63, 0x70, 0x35, 0x76, 0xb1, 0x31, 0x91, 0xa6, 0x49, 0xda, 0x8e, 0x99, + 0xcf, 0x82, 0x7f, 0x47, 0x3b, 0x79, 0x6f, 0xaa, 0x4d, 0x01, 0xff, 0xfc, + 0xf3, 0xeb, 0x49, 0x13, 0x9f, 0xa3, 0xb9, 0xea, 0xf5, 0x3e, 0x40, 0x00, + 0x40, 0x64, 0xf3, 0x53, 0xe2, 0x72, 0xcd, 0x75, 0x5b, 0x27, 0x66, 0x60, + 0x01, 0xca, 0x27, 0x95, 0xe3, 0xd5, 0xfa, 0x2d, 0x02, 0x0c, 0x97, 0xe0, + 0xfd, 0x29, 0x5f, 0x85, 0xcb, 0xf1, 0x3d, 0xa6, 0x44, 0x42, 0x46, 0x4d, + 0x20, 0x83, 0x6b, 0xa8, 0x97, 0xcb, 0x31, 0x35, 0x4b, 0x78, 0x03, 0x4c, + 0xf2, 0xe0, 0xe3, 0x1b, 0x8f, 0xa0, 0xc3, 0xb9, 0x94, 0x90, 0xcf, 0x7b, + 0x3c, 0x4b, 0xa0, 0xf8, 0xbd, 0x25, 0x5c, 0x2e, 0xb5, 0x9c, 0x37, 0x46, + 0x8a, 0x18, 0x2b, 0x51, 0x30, 0x07, 0x05, 0x0e, 0x77, 0xb9, 0x86, 0x5b, + 0x39, 0x1f, 0xec, 0xef, 0x45, 0x4d, 0xe6, 0x48, 0x01, 0x06, 0x7b, 0x70, + 0x2f, 0xde, 0x89, 0xf0, 0x24, 0x94, 0x08, 0x06, 0x54, 0xde, 0xba, 0x57, + 0xa2, 0x45, 0x48, 0x4a, 0xac, 0x26, 0x53, 0x03, 0x89, 0x9e, 0x0c, 0x78, + 0x6d, 0x8a, 0xa9, 0x05, 0xa6, 0x44, 0x6e, 0xc8, 0x71, 0x0f, 0xb0, 0x44, + 0x24, 0xd2, 0xda, 0x07, 0x22, 0xb0, 0x3e, 0x0d, 0xf2, 0x14, 0x24, 0x2c, + 0xb8, 0x1a, 0x0a, 0x5c, 0xed, 0xd5, 0x61, 0x2f, 0x00, 0xec, 0x23, 0xa9, + 0xfb, 0x45, 0xcb, 0xdd, 0x50, 0x6d, 0xc5, 0x91, 0x84, 0x97, 0x4f, 0x5b, + 0x31, 0xa9, 0x71, 0xb2, 0x6e, 0xc1, 0xa5, 0x2e, 0x23, 0xc2, 0xf5, 0xfe, + 0xfe, 0xb4, 0xdb, 0xb0, 0x84, 0x2c, 0xac, 0x65, 0x82, 0xb1, 0xae, 0xeb, + 0x38, 0x87, 0x97, 0x12, 0xb0, 0x44, 0xb2, 0x62, 0x1f, 0xfc, 0x21, 0xb1, + 0xe1, 0xb6, 0x04, 0x8b, 0x04, 0xf5, 0x9a, 0x93, 0xaa, 0x70, 0x5f, 0x62, + 0x96, 0x0c, 0x00, 0x40, 0xdb, 0xf5, 0xdc, 0x75, 0xfb, 0x04, 0xd2, 0xed, + 0xf1, 0x35, 0x09, 0xee, 0x84, 0xdf, 0x92, 0x28, 0x36, 0x21, 0x6d, 0xd7, + 0x48, 0xb7, 0x47, 0x3e, 0x6b, 0xa1, 0xdf, 0x5f, 0x17, 0x8d, 0xda, 0xdc, + 0x62, 0x57, 0xe5, 0x13, 0x67, 0x5a, 0xaa, 0x84, 0xef, 0x3e, 0x3c, 0xfd, + 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82, +} diff --git a/icons/disabledicon/disabledicon_win.go b/icons/disabledicon/disabledicon_win.go new file mode 100644 index 0000000..fa24233 --- /dev/null +++ b/icons/disabledicon/disabledicon_win.go @@ -0,0 +1,73 @@ +//go:build windows +// +build windows + +// File generated by 2goarray v0.1.0 (http://github.com/cratonica/2goarray) + +package disabledicon + +var Data []byte = []byte{ + 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x20, 0x20, 0x10, 0x00, 0x01, 0x00, + 0x04, 0x00, 0xe8, 0x02, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, 0x28, 0x00, + 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x01, 0x00, + 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf7, 0xb5, 0x00, 0x00, 0xff, 0x9b, + 0x63, 0x00, 0xe6, 0xbe, 0x51, 0x00, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x14, + 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x01, 0x43, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x33, 0x11, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x11, + 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x11, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x10, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, + 0x00, 0x00, 0x00, 0x00, 0x04, 0x44, 0x44, 0x40, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0x44, 0x00, 0x00, 0x44, + 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x40, + 0x00, 0x22, 0x22, 0x00, 0x04, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x44, 0x02, 0x22, 0x22, 0x22, 0x22, 0x20, 0x44, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x40, 0x22, 0x22, 0x00, 0x00, 0x02, + 0x22, 0x04, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x44, 0x02, 0x22, + 0x00, 0x00, 0x00, 0x00, 0x02, 0x20, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x04, 0x44, 0x02, 0x22, 0x00, 0x00, 0x00, 0x00, 0x02, 0x20, 0x44, 0x40, + 0x00, 0x00, 0x00, 0x04, 0x44, 0x44, 0x02, 0x20, 0x00, 0x00, 0x00, 0x00, + 0x02, 0x20, 0x44, 0x44, 0x40, 0x00, 0x00, 0x44, 0x44, 0x44, 0x02, 0x20, + 0x00, 0x00, 0x00, 0x00, 0x02, 0x20, 0x44, 0x44, 0x44, 0x00, 0x00, 0x44, + 0x44, 0x44, 0x02, 0x20, 0x00, 0x00, 0x00, 0x44, 0x02, 0x20, 0x44, 0x44, + 0x44, 0x00, 0x00, 0x04, 0x44, 0x44, 0x02, 0x20, 0x00, 0x00, 0x04, 0x44, + 0x42, 0x20, 0x44, 0x44, 0x40, 0x00, 0x00, 0x00, 0x04, 0x44, 0x02, 0x20, + 0x00, 0x00, 0x44, 0x44, 0x42, 0x20, 0x44, 0x40, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x44, 0x02, 0x22, 0x00, 0x00, 0x44, 0x44, 0x22, 0x20, 0x44, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x22, 0x22, 0x00, 0x44, 0x22, + 0x22, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x02, + 0x22, 0x22, 0x22, 0x22, 0x20, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x40, 0x00, 0x22, 0x22, 0x00, 0x04, 0x40, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x40, 0x00, 0x00, 0x04, + 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x04, 0x44, 0x44, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xc7, 0xff, 0xff, 0xff, 0x83, 0xff, 0xff, 0xff, 0x01, 0xff, + 0xff, 0xff, 0x01, 0xff, 0xff, 0xff, 0x01, 0xff, 0xff, 0xff, 0x83, 0xff, + 0xff, 0xff, 0x83, 0xf8, 0x1f, 0xff, 0xc7, 0xe0, 0x07, 0xff, 0xc7, 0x80, + 0x01, 0xff, 0xef, 0x00, 0x00, 0xff, 0xee, 0x00, 0x00, 0x7f, 0xf8, 0x00, + 0x00, 0x1f, 0xf0, 0x00, 0x00, 0x0f, 0xc0, 0x00, 0x00, 0x03, 0x80, 0x00, + 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, + 0x00, 0x01, 0xc0, 0x00, 0x00, 0x03, 0xf0, 0x00, 0x00, 0x0f, 0xf8, 0x00, + 0x00, 0x1f, 0xfe, 0x00, 0x00, 0x7f, 0xff, 0x00, 0x00, 0xff, 0xff, 0x80, + 0x01, 0xff, 0xff, 0xe0, 0x07, 0xff, 0xff, 0xf8, 0x1f, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, +} diff --git a/icons/enabledicon/enabled_icon.ico b/icons/enabledicon/enabled_icon.ico new file mode 100644 index 0000000..044b6f5 Binary files /dev/null and b/icons/enabledicon/enabled_icon.ico differ diff --git a/icons/enabledicon/enabledicon.go b/icons/enabledicon/enabledicon_unix.go similarity index 98% rename from icons/enabledicon/enabledicon.go rename to icons/enabledicon/enabledicon_unix.go index ebd4caf..1a48a9d 100644 --- a/icons/enabledicon/enabledicon.go +++ b/icons/enabledicon/enabledicon_unix.go @@ -1,35 +1,35 @@ -//go:build linux || darwin -// +build linux darwin - -// File generated by 2goarray v0.1.0 (http://github.com/cratonica/2goarray) - -package enabledicon - -var Data []byte = []byte{ - 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d, - 0x49, 0x48, 0x44, 0x52, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x20, - 0x08, 0x06, 0x00, 0x00, 0x00, 0x73, 0x7a, 0x7a, 0xf4, 0x00, 0x00, 0x00, - 0xf9, 0x49, 0x44, 0x41, 0x54, 0x58, 0x85, 0xed, 0x96, 0x4b, 0x1a, 0x83, - 0x20, 0x0c, 0x84, 0x07, 0xbe, 0xde, 0xb4, 0x7a, 0xaa, 0xea, 0x59, 0xe9, - 0xa6, 0xa1, 0x21, 0x10, 0x08, 0x14, 0xbb, 0x91, 0x59, 0x1a, 0x98, 0x7f, - 0x8c, 0x3c, 0x04, 0x96, 0x96, 0xee, 0x2e, 0x37, 0x38, 0x2f, 0xcc, 0xf2, - 0xeb, 0x9d, 0x10, 0x00, 0x20, 0x84, 0x32, 0xdf, 0xb9, 0x68, 0x67, 0xf6, - 0xb5, 0x0e, 0x4c, 0xc0, 0x0c, 0x94, 0x0e, 0xca, 0xeb, 0x4d, 0x7f, 0x4b, - 0x80, 0x08, 0xe7, 0xe0, 0xe7, 0x2b, 0xed, 0xc2, 0xb9, 0x7f, 0x6b, 0x22, - 0x48, 0x95, 0xd1, 0x0a, 0x90, 0xc0, 0x25, 0x54, 0xd3, 0xb9, 0x3b, 0x73, - 0x08, 0xad, 0x10, 0x49, 0x1a, 0x9c, 0xde, 0x98, 0x40, 0xdb, 0x91, 0x87, - 0xe0, 0xf3, 0x35, 0x5e, 0x29, 0x40, 0xf6, 0xbd, 0x39, 0x9c, 0xb7, 0x9a, - 0x8f, 0x23, 0xf1, 0x20, 0x85, 0x4e, 0x64, 0x4c, 0x2f, 0xc0, 0xd5, 0x55, - 0x2e, 0xe1, 0x25, 0x1d, 0x5b, 0xf9, 0x39, 0xf3, 0x8c, 0x1c, 0x1e, 0x20, - 0x82, 0x35, 0xb8, 0x26, 0x6d, 0x47, 0x68, 0x21, 0x44, 0x10, 0x78, 0x34, - 0xde, 0xba, 0x37, 0x84, 0x25, 0x10, 0x0f, 0xf1, 0x18, 0xa6, 0x56, 0x42, - 0xf4, 0xc8, 0xe3, 0xb3, 0x28, 0x46, 0x0d, 0x46, 0xc4, 0x17, 0x24, 0x75, - 0xc0, 0x01, 0x08, 0x54, 0xf8, 0xe5, 0x73, 0x18, 0xc1, 0xc4, 0x4c, 0x76, - 0x81, 0xc3, 0x85, 0xdd, 0x10, 0xdb, 0xb0, 0x79, 0x56, 0x77, 0x9d, 0x05, - 0x24, 0x39, 0xc6, 0x72, 0x37, 0x34, 0x8f, 0x62, 0x2d, 0x44, 0x4d, 0x33, - 0x8e, 0x62, 0x35, 0x04, 0xe9, 0x5f, 0x97, 0x51, 0xf4, 0xe4, 0xc6, 0x32, - 0x4c, 0xa5, 0x36, 0xe5, 0x3a, 0xae, 0x06, 0x49, 0xcc, 0x2e, 0xfc, 0x21, - 0x29, 0x06, 0x99, 0xe8, 0xb7, 0xb4, 0x74, 0x63, 0xbd, 0x01, 0xf9, 0xbd, - 0x91, 0x25, 0x45, 0xc6, 0x4b, 0x24, 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, - 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82, -} +//go:build linux || darwin +// +build linux darwin + +// File generated by 2goarray v0.1.0 (http://github.com/cratonica/2goarray) + +package enabledicon + +var Data []byte = []byte{ + 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d, + 0x49, 0x48, 0x44, 0x52, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x20, + 0x08, 0x06, 0x00, 0x00, 0x00, 0x73, 0x7a, 0x7a, 0xf4, 0x00, 0x00, 0x00, + 0xf9, 0x49, 0x44, 0x41, 0x54, 0x58, 0x85, 0xed, 0x96, 0x4b, 0x1a, 0x83, + 0x20, 0x0c, 0x84, 0x07, 0xbe, 0xde, 0xb4, 0x7a, 0xaa, 0xea, 0x59, 0xe9, + 0xa6, 0xa1, 0x21, 0x10, 0x08, 0x14, 0xbb, 0x91, 0x59, 0x1a, 0x98, 0x7f, + 0x8c, 0x3c, 0x04, 0x96, 0x96, 0xee, 0x2e, 0x37, 0x38, 0x2f, 0xcc, 0xf2, + 0xeb, 0x9d, 0x10, 0x00, 0x20, 0x84, 0x32, 0xdf, 0xb9, 0x68, 0x67, 0xf6, + 0xb5, 0x0e, 0x4c, 0xc0, 0x0c, 0x94, 0x0e, 0xca, 0xeb, 0x4d, 0x7f, 0x4b, + 0x80, 0x08, 0xe7, 0xe0, 0xe7, 0x2b, 0xed, 0xc2, 0xb9, 0x7f, 0x6b, 0x22, + 0x48, 0x95, 0xd1, 0x0a, 0x90, 0xc0, 0x25, 0x54, 0xd3, 0xb9, 0x3b, 0x73, + 0x08, 0xad, 0x10, 0x49, 0x1a, 0x9c, 0xde, 0x98, 0x40, 0xdb, 0x91, 0x87, + 0xe0, 0xf3, 0x35, 0x5e, 0x29, 0x40, 0xf6, 0xbd, 0x39, 0x9c, 0xb7, 0x9a, + 0x8f, 0x23, 0xf1, 0x20, 0x85, 0x4e, 0x64, 0x4c, 0x2f, 0xc0, 0xd5, 0x55, + 0x2e, 0xe1, 0x25, 0x1d, 0x5b, 0xf9, 0x39, 0xf3, 0x8c, 0x1c, 0x1e, 0x20, + 0x82, 0x35, 0xb8, 0x26, 0x6d, 0x47, 0x68, 0x21, 0x44, 0x10, 0x78, 0x34, + 0xde, 0xba, 0x37, 0x84, 0x25, 0x10, 0x0f, 0xf1, 0x18, 0xa6, 0x56, 0x42, + 0xf4, 0xc8, 0xe3, 0xb3, 0x28, 0x46, 0x0d, 0x46, 0xc4, 0x17, 0x24, 0x75, + 0xc0, 0x01, 0x08, 0x54, 0xf8, 0xe5, 0x73, 0x18, 0xc1, 0xc4, 0x4c, 0x76, + 0x81, 0xc3, 0x85, 0xdd, 0x10, 0xdb, 0xb0, 0x79, 0x56, 0x77, 0x9d, 0x05, + 0x24, 0x39, 0xc6, 0x72, 0x37, 0x34, 0x8f, 0x62, 0x2d, 0x44, 0x4d, 0x33, + 0x8e, 0x62, 0x35, 0x04, 0xe9, 0x5f, 0x97, 0x51, 0xf4, 0xe4, 0xc6, 0x32, + 0x4c, 0xa5, 0x36, 0xe5, 0x3a, 0xae, 0x06, 0x49, 0xcc, 0x2e, 0xfc, 0x21, + 0x29, 0x06, 0x99, 0xe8, 0xb7, 0xb4, 0x74, 0x63, 0xbd, 0x01, 0xf9, 0xbd, + 0x91, 0x25, 0x45, 0xc6, 0x4b, 0x24, 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, + 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82, +} diff --git a/icons/enabledicon/enabledicon_win.go b/icons/enabledicon/enabledicon_win.go new file mode 100644 index 0000000..5065a00 --- /dev/null +++ b/icons/enabledicon/enabledicon_win.go @@ -0,0 +1,73 @@ +//go:build windows +// +build windows + +// File generated by 2goarray v0.1.0 (http://github.com/cratonica/2goarray) + +package enabledicon + +var Data []byte = []byte{ + 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x20, 0x20, 0x10, 0x00, 0x01, 0x00, + 0x04, 0x00, 0xe8, 0x02, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, 0x28, 0x00, + 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x01, 0x00, + 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x9b, 0x63, 0x00, 0xff, 0xff, + 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x02, 0x22, 0x22, 0x20, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x22, 0x00, 0x00, 0x22, + 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x20, + 0x00, 0x11, 0x11, 0x00, 0x02, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x22, 0x01, 0x11, 0x11, 0x11, 0x11, 0x10, 0x22, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x20, 0x11, 0x10, 0x00, 0x00, 0x01, + 0x11, 0x02, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x22, 0x01, 0x10, + 0x00, 0x00, 0x00, 0x00, 0x01, 0x10, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x02, 0x22, 0x01, 0x10, 0x00, 0x00, 0x00, 0x00, 0x01, 0x10, 0x22, 0x20, + 0x00, 0x00, 0x00, 0x02, 0x22, 0x22, 0x01, 0x10, 0x00, 0x00, 0x00, 0x00, + 0x01, 0x10, 0x22, 0x22, 0x20, 0x00, 0x00, 0x22, 0x22, 0x22, 0x01, 0x10, + 0x00, 0x00, 0x00, 0x00, 0x01, 0x10, 0x22, 0x22, 0x22, 0x00, 0x00, 0x22, + 0x22, 0x22, 0x01, 0x10, 0x00, 0x00, 0x00, 0x22, 0x01, 0x10, 0x22, 0x22, + 0x22, 0x00, 0x00, 0x02, 0x22, 0x22, 0x01, 0x10, 0x00, 0x00, 0x02, 0x22, + 0x21, 0x10, 0x22, 0x22, 0x20, 0x00, 0x00, 0x00, 0x02, 0x22, 0x01, 0x10, + 0x00, 0x00, 0x22, 0x22, 0x21, 0x10, 0x22, 0x20, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x22, 0x01, 0x11, 0x00, 0x00, 0x22, 0x22, 0x11, 0x10, 0x22, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x11, 0x11, 0x00, 0x22, 0x11, + 0x11, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x01, + 0x11, 0x11, 0x11, 0x11, 0x10, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x20, 0x00, 0x11, 0x11, 0x00, 0x02, 0x20, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x20, 0x00, 0x00, 0x02, + 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x02, 0x22, 0x22, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xf8, 0x1f, 0xff, 0xff, 0xe0, 0x07, 0xff, 0xff, 0x80, + 0x01, 0xff, 0xff, 0x00, 0x00, 0xff, 0xfe, 0x00, 0x00, 0x7f, 0xf8, 0x00, + 0x00, 0x1f, 0xf0, 0x00, 0x00, 0x0f, 0xc0, 0x00, 0x00, 0x03, 0x80, 0x00, + 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, + 0x00, 0x01, 0xc0, 0x00, 0x00, 0x03, 0xf0, 0x00, 0x00, 0x0f, 0xf8, 0x00, + 0x00, 0x1f, 0xfe, 0x00, 0x00, 0x7f, 0xff, 0x00, 0x00, 0xff, 0xff, 0x80, + 0x01, 0xff, 0xff, 0xe0, 0x07, 0xff, 0xff, 0xf8, 0x1f, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, +} diff --git a/main.go b/main.go index d336158..f8e49fc 100644 --- a/main.go +++ b/main.go @@ -1,110 +1,98 @@ -package main - -import ( - "fmt" - "os/exec" - "strings" - "time" - - disabledicon "gitea.ronald1985.uk/ronald1985/Eye-Reminder/icons/disabledicon" - enabledicon "gitea.ronald1985.uk/ronald1985/Eye-Reminder/icons/enabledicon" - - "github.com/gen2brain/beeep" - "github.com/getlantern/systray" - ge "github.com/ronaldr1985/graceful-exit" -) - -const ( - TIME_INBETWEEN_NOTIFICATIONS = 20 * time.Minute -) - -func SendNotification(title string, message string) bool { - path, err := exec.LookPath("herbe") - if err == nil { - var args []string - args = append(args, title, message) - cmd := exec.Command(path, args...) - out, err := cmd.CombinedOutput() - if out == nil && err == nil { - return true - } - } else if strings.Contains(err.Error(), "executable file not found in $PATH") { - err := beeep.Notify(title, message, "") - if err != nil { - panic(err) - } - } - - return false -} - -func systrayOnReady() { - var enabled bool = true - systray.SetTitle("Eye Reminder") - systray.SetTooltip("Eye Reminder") - mQuitOrig := systray.AddMenuItem("Quit", "Quit the whole app") - - go func() { - <-mQuitOrig.ClickedCh - fmt.Println("Requesting quit") - systray.Quit() - fmt.Println("Finished quitting") - }() - - iconUpdated := false - go func() { - lastTimeNotificationWasSent := time.Now().Add(-20 * time.Minute) - - for { - if enabled { - if !iconUpdated { - systray.SetIcon(enabledicon.Data) - - iconUpdated = true - } - - if time.Since(lastTimeNotificationWasSent) > TIME_INBETWEEN_NOTIFICATIONS { - go func() { - SendNotification("Eye Reminder", "Look away for the screen for atleast 20 seconds") - }() - - lastTimeNotificationWasSent = time.Now() - } - } else { - if !iconUpdated { - systray.SetIcon(disabledicon.Data) - - iconUpdated = true - } - } - } - }() - - go func() { - systray.AddSeparator() - mEnabled := systray.AddMenuItemCheckbox("Enabled", "Check Me", true) - - for { - select { - case <-mEnabled.ClickedCh: - if mEnabled.Checked() { - mEnabled.Uncheck() - enabled = false - iconUpdated = false - } else { - mEnabled.Check() - enabled = true - iconUpdated = false - } - } - } - }() -} - -func main() { - ge.HandleSignals(false) - - systrayOnExit := func() { - } - systray.Run(systrayOnReady, systrayOnExit) -} +package main + +import ( + "fmt" + "os/exec" + "strings" + "time" + + disabledicon "gitea.ronald1985.uk/ronald1985/Eye-Reminder/icons/disabledicon" + enabledicon "gitea.ronald1985.uk/ronald1985/Eye-Reminder/icons/enabledicon" + + "github.com/gen2brain/beeep" + "github.com/getlantern/systray" + ge "github.com/ronaldr1985/graceful-exit" +) + +const ( + TIME_INBETWEEN_NOTIFICATIONS = 20 * time.Minute +) + +func SendNotification(title string, message string) bool { + path, err := exec.LookPath("herbe") + if err == nil { + var args []string + args = append(args, title, message) + cmd := exec.Command(path, args...) + out, err := cmd.CombinedOutput() + if out == nil && err == nil { + return true + } + } else if strings.Contains(err.Error(), "executable file not found in ") { + err := beeep.Notify(title, message, "assets/Eye-Reminder-Icon.png") + if err != nil { + panic(err) + } + } + + return false +} + +func systrayOnReady() { + var enabled bool = true + systray.SetTitle("Eye Reminder") + systray.SetTooltip("Eye Reminder") + systray.SetIcon(enabledicon.Data) + mQuitOrig := systray.AddMenuItem("Quit", "Quit the whole app") + + go func() { + <-mQuitOrig.ClickedCh + fmt.Println("Requesting quit") + systray.Quit() + fmt.Println("Finished quitting") + }() + + go func() { + lastTimeNotificationWasSent := time.Now().Add(-20 * time.Minute) + + for { + if enabled && time.Since(lastTimeNotificationWasSent) > TIME_INBETWEEN_NOTIFICATIONS { + SendNotification("Eye Reminder", "Look away for the screen for atleast 20 seconds") + + lastTimeNotificationWasSent = time.Now() + } + } + }() + + go func() { + systray.AddSeparator() + mEnabled := systray.AddMenuItemCheckbox("Enabled", "Check Me", true) + + for { + select { + case <-mEnabled.ClickedCh: + if mEnabled.Checked() { + mEnabled.Uncheck() + + enabled = false + + systray.SetIcon(disabledicon.Data) + } else { + mEnabled.Check() + + enabled = true + + systray.SetIcon(enabledicon.Data) + } + } + } + }() +} + +func main() { + ge.HandleSignals(false) + + systrayOnExit := func() { + } + systray.Run(systrayOnReady, systrayOnExit) +}