0

The task is relatively simple. If there is a process with a binary named x running, don't start another copy.

2 Answers 2

1

Starting with AwesomeWM v4.3, there is also raise_or_spawn

https://awesomewm.org/apidoc/libraries/awful.spawn.html#raise_or_spawn

0

You can use the below function which asynchronously checks whether a process is running and starts it if it's not:

function run_if_not_running(program, arguments)
   awful.spawn.easy_async(
      "pgrep " .. program,
      function(stdout, stderr, reason, exit_code)
         naughty.notify { text = stdout .. exit_code }
         if exit_code ~= 0 then
            awful.spawn(program .. " " .. arguments)
         end
   end)
end

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.