Skip to content

Commit

Permalink
onOff responds only to its events
Browse files Browse the repository at this point in the history
  • Loading branch information
ghedamat committed Jan 25, 2014
1 parent 485df9b commit 44c32cd
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions i3status/on_off.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,15 @@ func (w *OnOffWidget) sendMessage() {

func (w *OnOffWidget) readLoop() {
for {
<-w.Input
if w.On {
w.On = false
} else {
w.On = true
i := <-w.Input
if i.Name == "OnOff" {
if w.On {
w.On = false
} else {
w.On = true
}
go w.sendMessage()
}
go w.sendMessage()
}
}

Expand Down

0 comments on commit 44c32cd

Please sign in to comment.