Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dont connect to pulse unless we have a volume module in use #10

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions lib/pulse/pulse.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,22 @@ import (
log "github.com/sirupsen/logrus"
)

var initialized = false
var currentVolume float64

var lock sync.Mutex
var watchers []chan struct{}

func init() {
log.Info("connecting to pulse")
r := C.initialize()
if r != 0 {
log.Error("could not connect to pulse")
func Init() {
if !initialized {
initialized = true
log.Info("connecting to pulse")
r := C.initialize()
if r != 0 {
log.Error("could not connect to pulse")
}
go C.run()
}
go C.run()
}

func Volume() float64 {
Expand Down
1 change: 1 addition & 0 deletions ui/module/volume.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ func NewVolume(p ui.ParentDrawable, mk *markup.Markup) *Volume {
}

func (m *Volume) Init() error {
pulse.Init()
_, err := m.mk.Parse(m, m, `
<Row ref="Root">
<Sizer PaddingRight="{h_padding}">
Expand Down