Add icons to program
This commit is contained in:
		
							
								
								
									
										23
									
								
								Makefile
									
									
									
									
									
								
							
							
						
						
									
										23
									
								
								Makefile
									
									
									
									
									
								
							@@ -1,7 +1,26 @@
 | 
			
		||||
.PHONY: icon syso build clean
 | 
			
		||||
 | 
			
		||||
# Export CGO_ENABLED=1
 | 
			
		||||
CGO_ENABLED=1
 | 
			
		||||
# Export C compiler
 | 
			
		||||
CC=gcc
 | 
			
		||||
 | 
			
		||||
build:
 | 
			
		||||
	go build -ldflags "-H windowsgui" -o bin/
 | 
			
		||||
icon:
 | 
			
		||||
	magick convert ico/VolumeFix.png ico/VolumeFix.ico
 | 
			
		||||
	2goarray Icon ico < ico/VolumeFix.ico > ico/VolumeFix.go
 | 
			
		||||
 | 
			
		||||
syso:
 | 
			
		||||
	rsrc -ico ico/VolumeFix.ico -o bin/VolumeFix.syso
 | 
			
		||||
 | 
			
		||||
build: icon syso
 | 
			
		||||
	go build -ldflags "-H windowsgui" -o bin/
 | 
			
		||||
 | 
			
		||||
build-debug: icon syso
 | 
			
		||||
	go build -o bin/VolumeFix
 | 
			
		||||
 | 
			
		||||
clean:
 | 
			
		||||
	rm -f "ico/VolumeFix.ico"
 | 
			
		||||
	rm -f "ico/VolumeFix.go"
 | 
			
		||||
	rm -f "bin/VolumeFix.syso"
 | 
			
		||||
	rm -f "bin/VolumeFix.exe"
 | 
			
		||||
	rm -f "bin/VolumeFix"
 | 
			
		||||
@@ -1,6 +1,10 @@
 | 
			
		||||
# Volume Fix
 | 
			
		||||
Simple program that listens for volume changes, and changes the increment by 1 instead of 2
 | 
			
		||||
 | 
			
		||||
## Dependencies
 | 
			
		||||
- Needs `github.com/akavel/rsrc` to build the icon into the executable
 | 
			
		||||
- Needs `github.com/cratonica/2goarray` to generate a go file from the icon
 | 
			
		||||
 | 
			
		||||
## Building
 | 
			
		||||
`make build`
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										2
									
								
								go.sum
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								go.sum
									
									
									
									
									
								
							@@ -1,3 +1,5 @@
 | 
			
		||||
github.com/akavel/rsrc v0.10.2 h1:Zxm8V5eI1hW4gGaYsJQUhxpjkENuG91ki8B4zCrvEsw=
 | 
			
		||||
github.com/akavel/rsrc v0.10.2/go.mod h1:uLoCtb9J+EyAqh+26kdrTgmzRBFPGOolLWKpdxkKq+c=
 | 
			
		||||
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
 | 
			
		||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
 | 
			
		||||
github.com/getlantern/context v0.0.0-20190109183933-c447772a6520 h1:NRUJuo3v3WGC/g5YiyF790gut6oQr5f3FBI88Wv0dx4=
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										4
									
								
								main.go
									
									
									
									
									
								
							
							
						
						
									
										4
									
								
								main.go
									
									
									
									
									
								
							@@ -1,9 +1,9 @@
 | 
			
		||||
package main
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"VolumeFix/ico"
 | 
			
		||||
	"fmt"
 | 
			
		||||
	"github.com/getlantern/systray"
 | 
			
		||||
	"github.com/getlantern/systray/example/icon"
 | 
			
		||||
	"github.com/go-ole/go-ole"
 | 
			
		||||
	"github.com/moutend/go-hook/pkg/keyboard"
 | 
			
		||||
	"github.com/moutend/go-hook/pkg/types"
 | 
			
		||||
@@ -31,7 +31,7 @@ func main() {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func onReady() {
 | 
			
		||||
	systray.SetIcon(icon.Data)
 | 
			
		||||
	systray.SetIcon(ico.Icon)
 | 
			
		||||
	systray.SetTitle("Volume Fix")
 | 
			
		||||
	systray.SetTooltip("Volume Fix")
 | 
			
		||||
	quit := systray.AddMenuItem("Quit", "Quit the whole app")
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user