5 local host = io.popen("hostname")
6 utils.host = host:read("*l")
8 function utils.run_or_kill(command)
9 -- Check throught the clients if the class match the command
10 local lower_command=string.lower(command)
11 for k, c in pairs(client.get()) do
12 -- apparently some steam games don't have a client class
13 if c.class ~= nil then
14 local class=string.lower(c.class)
15 if string.match(class, lower_command) then
16 for i, v in ipairs(c:tags()) do
23 awful.util.spawn(command)
26 -- http://awesome.naquadah.org/wiki/Autostart#Simple_way
27 function utils.run_once(prg,arg_string,pname,screen)
36 if not arg_string then
37 awful.util.spawn_with_shell("pgrep -f -u $USER -x '" .. pname .. "' || (" .. prg .. ")",screen)
39 awful.util.spawn_with_shell("pgrep -f -u $USER -x '" .. pname .. " ".. arg_string .."' || (" .. prg .. " " .. arg_string .. ")",screen)
44 function utils.joinTables(t1, t2)
45 for k,v in ipairs(t2) do table.insert(t1, v) end return t1
48 function utils.rules.append(rules)
49 awful.rules.rules = awful.util.table.join(awful.rules.rules, rules)
52 function utils.globalkeys.append(keys)
53 globalkeys = awful.util.table.join(globalkeys, keys)