-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwlan.go
More file actions
50 lines (41 loc) · 1.03 KB
/
Copy pathwlan.go
File metadata and controls
50 lines (41 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
package main
import (
"github.com/barista-run/barista/bar"
"github.com/barista-run/barista/base/click"
"github.com/barista-run/barista/colors"
"github.com/barista-run/barista/outputs"
"github.com/barista-run/barista/pango"
"github.com/juli3nk/mybar-barista/modules/wlan"
)
func outputWifi(i wlan.Info) bar.Output {
if i.Connecting() {
return outputs.Pango(
pango.Icon("mdi-wifi"),
"...",
).Color(colors.Scheme("degraded"))
}
out := outputs.Group()
// First segment shown in summary mode only.
out.Append(outputs.Pango(
pango.Icon("mdi-wifi").Color(colors.Scheme("color10")),
spacer,
pango.Text(truncate(i.SSID, -9)),
).OnClick(click.Left(func() {
mainModalController.Toggle("network")
})))
// Full name
out.Append(outputs.Pango(
pango.Icon("mdi-wifi"),
spacer,
pango.Text(i.SSID),
))
// Frequency
out.Append(outputs.Textf("%2.1fG", i.Frequency.Gigahertz()))
// Mac address
out.Append(outputs.Pango(
pango.Icon("mdi-access-point"),
spacer,
pango.Text(i.AccessPointMAC).Small(),
))
return out
}