简体   繁体   English

awesome-wm中某些标签下的应用程序自动启动

[英]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. 我已经阅读了awesome-wm中特定应用程序的设置窗口布局 。现在我想在自动启动期间在某些标签下执行此操作。 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. 我打开我的电脑。像“firefox”这样的应用程序,“终端”将自动在标签1下运行。“”mplayer“将在标签2下运行。”xchat“将在标签3下运行。它们都是自动启动。

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. 我不希望“firefox”总是在标签1下面。我可以在任何我想要的标签下运行firefox。我只需要在计算机第一次打开时在标签1下运行。所以下面的代码无法使用。

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. 如果要在屏幕上的特殊标记中打开窗口,可以为窗口指定一个特殊名称(exp。“startup”),然后创建一个规则以仅在屏幕上启动名为“startup”的实例。

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! 我在Awesome的功能中使用纯lua创建了一个小小的要点,无需插件!

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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