Skip to content

Commit

Permalink
Not showing wifi info when no wifi (wtfutil#1124)
Browse files Browse the repository at this point in the history
  • Loading branch information
yosmoc committed Oct 13, 2021
1 parent 9918480 commit d06cf72
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions modules/security/widget.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,14 @@ func (widget *Widget) Refresh() {
func (widget *Widget) content() (string, string, bool) {
data := NewSecurityData()
data.Fetch()
str := fmt.Sprintf(" [%s]WiFi[white]\n", widget.settings.Colors.Subheading)
str += fmt.Sprintf(" %8s: %s\n", "Network", data.WifiName)
str += fmt.Sprintf(" %8s: %s\n", "Crypto", data.WifiEncryption)
str += "\n"
var str string

if data.WifiName != "" {
str += fmt.Sprintf(" [%s]WiFi[white]\n", widget.settings.Colors.Subheading)
str += fmt.Sprintf(" %8s: %s\n", "Network", data.WifiName)
str += fmt.Sprintf(" %8s: %s\n", "Crypto", data.WifiEncryption)
str += "\n"
}

str += fmt.Sprintf(" [%s]Firewall[white]\n", widget.settings.Colors.Subheading)
str += fmt.Sprintf(" %8s: %4s\n", "Status", data.FirewallEnabled)
Expand Down

0 comments on commit d06cf72

Please sign in to comment.