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?


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])
-- }}}

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.