Example #1
0
func TestOnOffWidgetConstructor(t *testing.T) {
	Convey("Given an input and an output channel", t, func() {
		bar := i3status.NewBar()
		Convey("When OnOff is created", func() {
			w := i3status.NewOnOffWidget()
			bar.Add(w)
			Convey("output channel is available", func() {
				So(w.Output, ShouldEqual, bar.Input)
			})
		})
	})
}
Example #2
0
func main() {

	/*
		go func() {
			for {
				fmt.Println("{\"name\":\"testiii\",\"full_text\":\"ciao\"}")
				time.Sleep(1 * time.Second)
			}
		}()

		go func() {
			var i int
			for {
				fmt.Scanf("%d", &i)
				fmt.Println(i)
			}
		}()
	*/
	fmt.Println(`{"version":1,"click_events": true}`)
	fmt.Println("[")
	b := i3status.NewBar()

	b.Add(i3status.NewDateWidget())
	b.Add(i3status.NewTimerWidget())
	b.Add(i3status.NewPowerWidget())
	b.Add(i3status.NewOnOffWidget())
	b.Add(i3status.NewWlanWidget())
	b.Add(i3status.NewWeatherWidget())
	//b.Add(i3status.NewI3statusWidget())
	//b.Add(i3status.NewEchoWidget())

	for {
		m := <-b.Output
		fmt.Println(m + ",")
	}

}