6

我已经阅读了在 awesome-wm 中为特定应用程序设置窗口布局。现在我想在自动启动期间在特定标签下执行此操作。例如:

我打开我的电脑。像“firefox”、“终端”之类的应用程序将自动在标签 1 下运行。“mplayer”将在标签 2 下运行。“xchat”将在标签 3 下运行。它们都自动启动。

我不希望“firefox”总是在标签 1 下。我可以在任何我想要的标签下运行 firefox。我只需要在第一次打开计算机时在标签 1 下运行。所以下面的代码不能使用。

awful.rules.rules = {
-- All clients will match this rule.
{ rule = { class = "Firefox" },
 properties = { tag = tags[1][2]}}, --,switchtotag=true} },
 ...
4

3 回答 3

5

你看过很棒的维基页面吗?我认为这就是您要寻找的:

   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")

这段代码来自很棒的 wiki。您可以将屏幕作为参数传递给此函数。有关更多详细信息,请查看上面的链接。如果您想在屏幕上的特殊标签中打开窗口,您可以给窗口一个特殊的名称(例如“startup”),然后创建一个规则以仅在屏幕上启动名为“startup”的实例。

例子:

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

...
 rule = { class = "Firefox", instance = "startup" }, properties = {tag = tags[2]}},
...
于 2013-05-18T15:02:47.060 回答
2

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

于 2013-02-22T12:20:29.370 回答
2

我创建了一个小要点,用于在 Awesome 的功能范围内使用纯 lua 完成这项任务,并且不需要插件!

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

于 2014-02-07T07:10:58.187 回答