Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Application autostart under certain tag in awesome-wm

Tags:

awesome-wm

I have read Setting windows layout for a specific application in awesome-wm.Now I want to do this under certain tag during autostart. For example:

I turn on my pc.Apps like "firefox","terminal" will automatically run under tag 1." "mplayer" will run under tag 2. "xchat" will run under tag 3. They all autostart.

I don't want "firefox" always under tag 1. I could run firefox under any tags I want.I just need it run under tag 1 when computer is first turned on.So code below couldn't be used.

awful.rules.rules = {
-- All clients will match this rule.
{ rule = { class = "Firefox" },
 properties = { tag = tags[1][2]}}, --,switchtotag=true} },
 ...
like image 718
winoi Avatar asked Feb 22 '13 08:02

winoi


2 Answers

Have you looked on the awesome wiki pages? I think this is what you are lookin for:

   function run_once(prg,arg_string,pname,screen)
    if not prg then
        do return nil end
    end

    if not pname then
       pname = prg
    end

    if not arg_string then 
        awful.util.spawn_with_shell("pgrep -f -u $USER -x '" .. pname .. "' || (" .. prg .. ")",screen)
    else
        awful.util.spawn_with_shell("pgrep -f -u $USER -x '" .. pname .. " ".. arg_string .."' || (" .. prg .. " " .. arg_string .. ")",screen)
    end
end

run_once("xscreensaver","-no-splash")
run_once("pidgin",nil,nil,2)
run_once("wicd-client",nil,"/usr/bin/python2 -O /usr/share/wicd/gtk/wicd-client.py")

This code is from the awesome wiki. You can pass the screen as an argument to this function. For more details look at the link above. If you want to open the window in a special tag on a screen you could give the window a special name (exp. "startup") and then create a rule to launch only the instances named "startup" on the screen.

Example:

run_once("firefox","startup, nil, 1)

...
 rule = { class = "Firefox", instance = "startup" }, properties = {tag = tags[2]}},
...
like image 194
Nyquist Avatar answered Oct 29 '22 21:10

Nyquist


Check out shifty- there you can specify the tab for the application, but you can still move it to a different tab.

like image 21
Rainer Avatar answered Oct 29 '22 22:10

Rainer