Created
June 15, 2011 21:08
-
-
Save katspaugh/1028116 to your computer and use it in GitHub Desktop.
dwm statusbar
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local function exec (cmd, ...) | |
local argstr = (table.maxn(arg) == 0 and '') or | |
string.format(' %q', table.concat(arg)) | |
return os.execute(cmd .. argstr) | |
end | |
local function read (cmd) | |
local prog = io.popen(cmd) | |
local pout = prog:read('*a') | |
prog:close() | |
return pout | |
end | |
repeat | |
local wlan = read('ifconfig wlan0') | |
wlan = table.concat({ | |
string.match(wlan, 'ssid (%a+)') or 'no ssid', | |
string.match(wlan, 'status: ([^%c]+)') or 'no carrier' | |
}, ': ') | |
local date = table.concat({ | |
string.match( | |
os.date(), | |
'(%a+) (%a+ %d+) (%d+:%d+):%d+ (%d+)' | |
) | |
}, ' ') | |
exec( | |
'xsetroot -name', | |
table.concat({ wlan, date }, ' | ') | |
) | |
until 0 < exec('sleep', 10) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment