-
-
Save skakri/40975691c78b411a966f142424efb703 to your computer and use it in GitHub Desktop.
This is a small gist for autostarting applications with Awesome Window Manager (http://awesome.naquadah.org/) without the need to use a third party plugin like shifty. It's maybe not nice but works!
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
-- {{{ | |
-- | |
-- Autostarting for Awesome <3.4! | |
-- Add this section to the end of your rc.lua | |
-- configuration file within ~/.config/awesome/rc.lua | |
-- | |
-- If you're using Awesome 3.5 change: | |
-- add_signal -> connect_signal | |
-- remove_signal --> disconnect_signal | |
-- | |
-- Thanks to eri_trabiccolo as well as psychon | |
-- | |
function spawn_once(command, class, tag) | |
-- create move callback | |
local callback | |
callback = function(c) | |
if c.class == class then | |
awful.client.movetotag(tag, c) | |
client.remove_signal("manage", callback) | |
end | |
end | |
client.add_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 | |
-- use the spawn_once | |
spawn_once("subl", "Sublime_text", tags[1][2]) | |
spawn_once("chromium", "Chromium", tags[1][3]) | |
spawn_once("thunar", "Thunar", tags[1][4]) | |
spawn_once("xchat", "Xchat", tags[1][5]) | |
-- }}} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment