简体   繁体   中英

Application autostart under certain tag in 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} },
 ...

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]}},
...

检查shifty - 您可以在其中指定应用程序的选项卡,但您仍然可以将其移动到其他选项卡。

I created a small gist for doing that task with pure lua within the capabilities of Awesome and no need for plugins!

https://gist.github.com/Flowkap/8858434

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM