2 local io = { popen = io.popen }
3 local string = { match = string.match,
9 local host = io.popen("hostname")
10 utils.host = host:read("*l")
12 function utils.run_or_kill(prg, cprop, screen)
21 if not cprop.class then
25 if not cprop.instance then
29 cprop.class = string.lower(cprop.class)
30 cprop.instance = string.lower(cprop.instance)
32 for k, c in pairs(client.get()) do
33 -- apparently some steam games don't have a client class
34 if c.class == nil then
37 local class=string.lower(c.class)
38 local instance=string.lower(c.instance)
39 if string.match(class, cprop.class) and string.match(instance, cprop.instance) then
40 for i, v in ipairs(c:tags()) do
46 awful.util.spawn_with_shell(prg, screen)
49 -- http://awesome.naquadah.org/wiki/Autostart#Simple_way
50 function utils.run_once(prg,arg_string,pname,screen)
59 if not arg_string then
60 awful.util.spawn_with_shell("pgrep -f -u $USER -x '" .. pname .. "' || (" .. prg .. ")",screen)
62 awful.util.spawn_with_shell("pgrep -f -u $USER -x '" .. pname .. " ".. arg_string .."' || (" .. prg .. " " .. arg_string .. ")",screen)
66 function utils.get_default_sink()
67 local f = io.popen('ponymix defaults --short')
70 return string.match(line, "^sink%s*%d*%s*(.-)%s")
73 function utils.joinTables(t1, t2)
74 for k,v in ipairs(t2) do table.insert(t1, v) end return t1
77 function utils.rules.append(rules)
78 awful.rules.rules = awful.util.table.join(awful.rules.rules, rules)
81 function utils.globalkeys.append(keys)
82 globalkeys = awful.util.table.join(globalkeys, keys)