Skip to content

Commit

Permalink
Switch to log package and be less verbose
Browse files Browse the repository at this point in the history
  • Loading branch information
muesli committed May 27, 2021
1 parent 6d9d393 commit 9328b84
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 10 deletions.
1 change: 0 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ require (
github.com/StackExchange/wmi v0.0.0-20190523213315-cbe66965904d // indirect
github.com/atotto/clipboard v0.1.4
github.com/bendahl/uinput v1.4.1
github.com/davecgh/go-spew v1.1.1
github.com/flopp/go-findfont v0.0.0-20201114153133-e7393a00c15b
github.com/go-ole/go-ole v1.2.4 // indirect
github.com/godbus/dbus v4.1.0+incompatible
Expand Down
13 changes: 6 additions & 7 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import (
"time"

"github.com/bendahl/uinput"
"github.com/davecgh/go-spew/spew"
"github.com/godbus/dbus"
"github.com/muesli/streamdeck"
)
Expand All @@ -29,7 +28,7 @@ var (
)

func handleActiveWindowChanged(dev streamdeck.Device, event ActiveWindowChangedEvent) {
fmt.Printf("Active window changed to %s (%d, %s)\n",
log.Printf("Active window changed to %s (%d, %s)\n",
event.Window.Class, event.Window.ID, event.Window.Name)

// remove dupes
Expand Down Expand Up @@ -105,7 +104,7 @@ func main() {
if err != nil {
log.Fatal(err)
}
fmt.Printf("Found device with serial %s (firmware %s)\n",
log.Printf("Found device with serial %s (firmware %s)\n",
dev.Serial, ver)

err = dev.Reset()
Expand Down Expand Up @@ -149,19 +148,19 @@ func main() {
}
continue
}
spew.Dump(k)
// spew.Dump(k)

var state bool
if ks, ok := keyStates.Load(k.Index); ok {
state = ks.(bool)
}
// fmt.Println("Storing state", k.Pressed)
// log.Println("Storing state", k.Pressed)
keyStates.Store(k.Index, k.Pressed)

if state && !k.Pressed {
// key was released
if time.Since(keyTimestamps[k.Index]) < 200*time.Millisecond {
fmt.Println("Triggering short action")
// log.Println("Triggering short action")
deck.triggerAction(k.Index, false)
}
}
Expand All @@ -173,7 +172,7 @@ func main() {

if state, ok := keyStates.Load(k.Index); ok && state.(bool) {
// key still pressed
fmt.Println("Triggering long action")
// log.Println("Triggering long action")
deck.triggerAction(k.Index, true)
}
}()
Expand Down
3 changes: 1 addition & 2 deletions widget.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package main

import (
"fmt"
"image"
"image/color"
"image/draw"
Expand Down Expand Up @@ -90,7 +89,7 @@ func NewWidget(index uint8, id string, action *ActionConfig, actionHold *ActionC

default:
// unknown widget ID
fmt.Println("Unknown widget with ID:", id)
log.Println("Unknown widget with ID:", id)
}

return nil
Expand Down

0 comments on commit 9328b84

Please sign in to comment.