Created
February 15, 2016 02:24
-
-
Save aajjbb/b58df8d0e9f60e6cfaf0 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- On rc.lua | |
function spawn_once(command, class, tag) | |
-- create move callback | |
local callback | |
callback = function(c) | |
if c.name == class then | |
awful.client.movetotag(tag, c) | |
client.disconnect_signal("manage", callback) | |
end | |
end | |
client.connect_signal("manage", callback) | |
-- now check if not already running! | |
local findme = command | |
local firstspace = findme:find(" ") | |
if firstspace then | |
findme = findme:sub(0, firstspace-1) | |
end | |
-- finally run it | |
awful.util.spawn_with_shell("pgrep -u $USER -x " .. findme .. " > /dev/null || (" .. command .. ")") | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment