From: Samir Benmendil Date: Wed, 12 Jun 2013 02:12:16 +0000 (+0200) Subject: create utils module, with function to run or kill X-Git-Url: https://git.rmz.io/dotfiles.git/commitdiff_plain/fe37fd5a0ed2d23f478a09a92959dd4a9ba5a733?ds=sidebyside create utils module, with function to run or kill --- diff --git a/awesome/utils.lua b/awesome/utils.lua new file mode 100644 index 0000000..c7a5492 --- /dev/null +++ b/awesome/utils.lua @@ -0,0 +1,18 @@ +local utils = { } + +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 + end + end + end + awful.util.spawn(command) +end + +return utils