Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm running Awesome WM v3.5.1 on ArchLinux and I would like to automatically open some programs at startup in specific tabs (like opening a terminal in the "main" tab, a browser in "web" or a text editor and a terminal in the "dev" tab).

I tried using rules in rc.lua but I want to put in specific tabs the programs only at startup and not the ones I manually start. Also they shouldn't mess up when I use the restart button of the window manager.

How can I do this?

share|improve this question

add to rc.lua and try

i have multiple monitors, it is not being able to set it to the desired tag, maybe it can work on 1 monitor

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)
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)
-- finally run it
awful.util.spawn_with_shell("pgrep -u $USER -x " .. findme .. " > /dev/null || (" .. command .. ")")

-- 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])
-- }}}
share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .