local host = io.popen("hostname")
utils.host = host:read("*l")
+function utils.is_dir(path)
+ return os.execute(('[ -d "%s" ]'):format(path))
+end
+
function utils.run_or_kill(prg, cprop, screen)
if not prg then
do return nil end
local f = io.popen('ponymix defaults --short')
line = f:read('*l')
f:close()
- return string.match(line, "^sink%s*%d*%s*(.-)%s")
+ return string.match(line, "^sink%s*%d*%s*(.-)%s") or ""
end
function utils.joinTables(t1, t2)
globalkeys = awful.util.table.join(globalkeys, keys)
end
+function utils.has_battery()
+ return utils.is_dir("/sys/class/power_supply/BAT0")
+end
+
return utils