mirror of
https://github.com/prashantgupta24/automatic-mouse-mover.git
synced 2024-12-22 08:24:11 +00:00
commit
7cf54ae179
3
.gitignore
vendored
3
.gitignore
vendored
@ -1 +1,2 @@
|
||||
vendor/
|
||||
vendor/
|
||||
bin/
|
21
LICENSE
Normal file
21
LICENSE
Normal file
@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2019 Prashant Gupta
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
26
Makefile
26
Makefile
@ -1,5 +1,29 @@
|
||||
all: open
|
||||
|
||||
build: clean
|
||||
mkdir -p -v ./bin/amm.app/Contents/Resources
|
||||
mkdir -p -v ./bin/amm.app/Contents/MacOS
|
||||
cp ./appInfo/*.plist ./bin/amm.app/Contents/Info.plist
|
||||
cp ./appInfo/*.icns ./bin/amm.app/Contents/Resources/icon.icns
|
||||
go build -o ./bin/amm.app/Contents/MacOS/amm cmd/main.go
|
||||
|
||||
open: build
|
||||
open ./bin
|
||||
|
||||
clean:
|
||||
rm -rf ./bin
|
||||
|
||||
start:
|
||||
go run cmd/main.go
|
||||
|
||||
test:
|
||||
go test -v -race -failfast ./...
|
||||
go test -v -race -failfast ./...
|
||||
|
||||
vet:
|
||||
go vet $(shell glide nv)
|
||||
|
||||
lint:
|
||||
go list ./... | grep -v vendor | xargs -L1 golint -set_exit_status
|
||||
|
||||
.PHONY: build
|
||||
.PHONY: clean
|
1
README.md
Normal file
1
README.md
Normal file
@ -0,0 +1 @@
|
||||
## Presenting the minimalistic Automatic-Mouse-Mover(AMM) app!
|
16
appInfo/Info.plist
Normal file
16
appInfo/Info.plist
Normal file
@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>amm</string>
|
||||
<key>CFBundleIconFile</key>
|
||||
<string>icon.icns</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>com.pg.amm</string>
|
||||
<key>NSHighResolutionCapable</key>
|
||||
<true/>
|
||||
<key>LSUIElement</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</plist>
|
BIN
appInfo/icon.icns
Normal file
BIN
appInfo/icon.icns
Normal file
Binary file not shown.
1456
assets/icon/trayIcon.go
Normal file
1456
assets/icon/trayIcon.go
Normal file
File diff suppressed because it is too large
Load Diff
@ -4,7 +4,7 @@ import (
|
||||
"fmt"
|
||||
|
||||
"github.com/getlantern/systray"
|
||||
"github.com/getlantern/systray/example/icon"
|
||||
"github.com/prashantgupta24/automatic-mouse-mover/assets/icon"
|
||||
"github.com/prashantgupta24/automatic-mouse-mover/pkg/mousemover"
|
||||
)
|
||||
|
||||
@ -15,7 +15,6 @@ func main() {
|
||||
func onReady() {
|
||||
go func() {
|
||||
systray.SetIcon(icon.Data)
|
||||
systray.SetTitle("AMM")
|
||||
ammStart := systray.AddMenuItem("Start", "start the app")
|
||||
ammStop := systray.AddMenuItem("Stop", "stop the app")
|
||||
systray.AddSeparator()
|
||||
|
@ -9,9 +9,10 @@ import (
|
||||
"github.com/prashantgupta24/activity-tracker/pkg/tracker"
|
||||
)
|
||||
|
||||
var instance *mouseMover
|
||||
var instance *MouseMover
|
||||
|
||||
type mouseMover struct {
|
||||
//MouseMover is the main struct for the app
|
||||
type MouseMover struct {
|
||||
quit chan struct{}
|
||||
isRunning bool
|
||||
}
|
||||
@ -20,7 +21,8 @@ const (
|
||||
timeout = 100 //ms
|
||||
)
|
||||
|
||||
func (m *mouseMover) Start() {
|
||||
//Start the main app
|
||||
func (m *MouseMover) Start() {
|
||||
m.quit = make(chan struct{})
|
||||
|
||||
frequency := 5 //value always in seconds
|
||||
@ -31,7 +33,7 @@ func (m *mouseMover) Start() {
|
||||
|
||||
heartbeatCh := activityTracker.Start()
|
||||
|
||||
go func(m *mouseMover) {
|
||||
go func(m *MouseMover) {
|
||||
m.isRunning = true
|
||||
movePixel := 10
|
||||
for {
|
||||
@ -70,7 +72,8 @@ func moveMouse(movePixel int, commCh chan bool) {
|
||||
commCh <- true
|
||||
}
|
||||
|
||||
func (m *mouseMover) Quit() {
|
||||
//Quit the app
|
||||
func (m *MouseMover) Quit() {
|
||||
//making it idempotent
|
||||
if m != nil && m.isRunning {
|
||||
m.quit <- struct{}{}
|
||||
@ -78,9 +81,9 @@ func (m *mouseMover) Quit() {
|
||||
}
|
||||
|
||||
//GetInstance gets the singleton instance for mouse mover app
|
||||
func GetInstance() *mouseMover {
|
||||
func GetInstance() *MouseMover {
|
||||
if instance == nil {
|
||||
instance = &mouseMover{}
|
||||
instance = &MouseMover{}
|
||||
}
|
||||
return instance
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user