Skip to content

Commit

Permalink
show essid when connected to wireless network
Browse files Browse the repository at this point in the history
  • Loading branch information
niklas committed Jan 19, 2012
1 parent c643b52 commit e2b0e46
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions status/network.yaml
Expand Up @@ -2,15 +2,21 @@ status:
network:
params:
ifconfig: /sbin/ifconfig
iwconfig: /sbin/iwconfig
interface: lo

script: |
def ifconfig
`#{@ifconfig} #{@interface} 2>&1`
end
def iwconfig
`#{@iwconfig} #{@interface} 2>&1`
end
label: |
ifconfig = self.ifconfig
alive = ifconfig !~ /\A\S+ error/
ip_addr = ifconfig[/inet (?:addr:)?([\d.]+)/, 1]
Expand All @@ -23,6 +29,16 @@ status:
stats = []
end
iwconfig = self.iwconfig
if iwconfig.match(/IEEE 802\.11/s)
if match = iwconfig.match(/ESSID:"([^"]+)"/)
stats.unshift match[1]
stats.unshift "\u223f"
else
color = 'error'
end
end
[color, @interface, stats]
control:
Expand Down

0 comments on commit e2b0e46

Please sign in to comment.