]> git.rmz.io Git - dotfiles.git/blobdiff - awesome/utils.lua
fix conkyrc
[dotfiles.git] / awesome / utils.lua
index c7a5492f88217c985c4caadf7f0ee98c4007289d..0ec93aa355f14c5abd5dfd22df7486bf29b01576 100644 (file)
@@ -1,18 +1,38 @@
 local utils = { }
+utils.rules = { }
+utils.globalkeys = { }
+
+local host = io.popen("hostname")
+utils.host = host:read("*l")
 
 function utils.run_or_kill(command)
     -- Check throught the clients if the class match the command
     local lower_command=string.lower(command)
     for k, c in pairs(client.get()) do
-        local class=string.lower(c.class)
-        if string.match(class, lower_command) then
-            for i, v in ipairs(c:tags()) do
-                c:kill()
-                return
+        -- apparently some steam games don't have a client class
+        if c.class ~= nil then
+            local class=string.lower(c.class)
+            if string.match(class, lower_command) then
+                for i, v in ipairs(c:tags()) do
+                    c:kill()
+                    return
+                end
             end
         end
     end
     awful.util.spawn(command)
 end
 
+function utils.joinTables(t1, t2)
+    for k,v in ipairs(t2) do table.insert(t1, v) end return t1
+end
+
+function utils.rules.append(rules)
+    awful.rules.rules = awful.util.table.join(awful.rules.rules, rules)
+end
+
+function utils.globalkeys.append(keys)
+    globalkeys = awful.util.table.join(globalkeys, keys)
+end
+
 return utils