diff options
author | Jonathan McCrohan <jmccrohan@gmail.com> | 2017-07-11 22:39:53 +0100 |
---|---|---|
committer | Jonathan McCrohan <jmccrohan@gmail.com> | 2017-07-11 22:40:20 +0100 |
commit | be3296d9bde06b9abe89b5f4685e94ded324834f (patch) | |
tree | 3a51e0915b603e89ffb90728ec0a78ddc91ac62a /.config/awesome/functions | |
parent | 8d135a4f08667c7359380b9e54ef79d8e2ba1afd (diff) | |
download | awesome-be3296d9bde06b9abe89b5f4685e94ded324834f.tar.gz |
merge run_once into rc.lua
Diffstat (limited to '.config/awesome/functions')
-rw-r--r-- | .config/awesome/functions/run_once.lua | 35 |
1 files changed, 0 insertions, 35 deletions
diff --git a/.config/awesome/functions/run_once.lua b/.config/awesome/functions/run_once.lua deleted file mode 100644 index 7c57482..0000000 --- a/.config/awesome/functions/run_once.lua +++ /dev/null @@ -1,35 +0,0 @@ -local awful = require("awful") -local lfs = require("lfs") - -local function processwalker() - local function yieldprocess() - for dir in lfs.dir("/proc") do - if tonumber(dir) ~= nil then - local f, err = io.open("/proc/"..dir.."/cmdline") - if f then - local cmdline = f:read("*all") - f:close() - if cmdline ~= "" then - coroutine.yield(cmdline) - end - end - end - end - end - return coroutine.wrap(yieldprocess) -end - -function run_once(process, cmd) - assert(type(process) == "string") - local regex_killer = { - ["+"] = "%+", ["-"] = "%-", - ["*"] = "%*", ["?"] = "%?" } - - for p in processwalker() do - if p:find(process:gsub("[-+?*]", regex_killer)) then - return - end - end - return awful.spawn(cmd or process) -end --- run once END |