From b9011b743bb5d1aa3f80e30d598b4493898f4b4a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=96zg=C3=BCr=20Kesim?= Date: Sat, 2 Apr 2022 11:29:40 +0200 Subject: [PATCH] choose loudspeaker icons depending on volume --- main.go | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/main.go b/main.go index 6a09875..ed9e2ee 100644 --- a/main.go +++ b/main.go @@ -37,7 +37,17 @@ func printvol(c *pulseaudio.Client) float32 { if e != nil { fmt.Println(e) } else { - fmt.Printf("%d%%\n", int(100*v)) + var c rune + if v < 0.1 { + c = '' + } else if v < 0.5 { + c = '' + } else if v < 0.8 { + c = '' + } else { + c = '' + } + fmt.Printf("%c % 2d%%\n", c, int(100*v)) } return v }