Display active network profile

This commit is contained in:
Brian Buller 2015-12-17 22:16:42 -06:00
parent 8c99923a50
commit 44b1a33efe
1 changed files with 16 additions and 5 deletions

View File

@ -80,6 +80,8 @@ func (screen *mainScreen) drawScreen(style style) {
screen.battStat.GetX()+screen.battStat.GetWidth(),
screen.battStat.GetY(), style.defaultFg, style.defaultBg)
termboxUtil.DrawStringAtPoint(getNetworkProfile(), 0, h-1, style.defaultFg, style.defaultBg)
refreshText := "(r)efresh"
if state.autoUpdate {
refreshText = "Auto-Refresh On ("
@ -120,11 +122,20 @@ func getBatteryPct() int {
}
func getNetworkProfile() string {
netProfile := "net_profile"
cmd := exec.Command(netProfile)
netApp := "netctl"
netArg1 := "list"
cmd := exec.Command(netApp, netArg1)
stdout, err := cmd.Output()
if err != nil {
return "No Network"
if err == nil {
tst := string(stdout)
for _, k := range strings.Split(tst, "\n") {
pair := strings.Split(k, " ")
if len(pair) > 1 {
if pair[0] == "*" {
return pair[1]
}
}
}
}
return string(stdout)
return "No Network"
}