我已经阅读了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} },
...
Run Code Online (Sandbox Code Playgroud)
你看过很棒的维基页面了吗?我认为这是你正在寻找的:
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")
Run Code Online (Sandbox Code Playgroud)
这段代码来自很棒的维基.您可以将屏幕作为参数传递给此函数.有关详细信息,请查看上面的链接.如果要在屏幕上的特殊标记中打开窗口,可以为窗口指定一个特殊名称(exp."startup"),然后创建一个规则以仅在屏幕上启动名为"startup"的实例.
例:
run_once("firefox","startup, nil, 1)
...
rule = { class = "Firefox", instance = "startup" }, properties = {tag = tags[2]}},
...
Run Code Online (Sandbox Code Playgroud)