autostart app with tag in awm
- by nonsenz
while giving awm a try i encounter some problems. i want to autostart some apps when awm is started with specific tags. here's the relevant config i use for that.
first my tags with layouts:
tags = {
names = {"mail", "www", "video", "files", 5, 6, 7, 8, 9},
layout = {layouts[11], layouts[11], layouts[11], layouts[11], layouts[1], layouts[1], layouts[1], layouts[1], layouts[1]}
}
for s = 1, screen.count() do
-- Each screen has its own tag table.
tags[s] = awful.tag(tags.names, s, tags.layout)
end
now the app-autostart stuff:
awful.util.spawn("chromium-browser")
awful.util.spawn("firefox")
awful.util.spawn("vlc")
awful.util.spawn_with_shell("xterm -name files -e mc")
awful.util.spawn_with_shell("xterm -name 5term")
awful.util.spawn_with_shell("xterm -name 5term")
awful.util.spawn_with_shell("xterm -name 5term")
awful.util.spawn_with_shell("xterm -name 5term")
awful.util.spawn_with_shell("xfce4-power-manager")
i use xterm with the -name param to give them custom classes (for custom tags via rules).
and now some rules to connect apps with tags:
awful.rules.rules = {
-- All clients will match this rule.
{ rule = { },
properties = { border_width = beautiful.border_width,
border_color = beautiful.border_normal,
focus = true,
keys = clientkeys,
buttons = clientbuttons } },
{ rule = { class = "MPlayer" },
properties = { floating = true } },
{ rule = { class = "pinentry" },
properties = { floating = true } },
{ rule = { class = "gimp" },
properties = { floating = true } },
-- Set Firefox to always map on tags number 2 of screen 1.
-- { rule = { class = "Firefox" },
-- properties = { tag = tags[1][2] } },
{ rule = { class = "Firefox" },
properties = { tag = tags[1][2] } },
{ rule = { class = "Chromium-browser" },
properties = { tag = tags[1][1] } },
{ rule = { class = "Vlc"},
properties = { tag = tags[1][3] } },
{ rule = { class = "files"},
properties = { tag = tags[1][4] } },
{ rule = { class = "5term"},
properties = { tag = tags[1][5] } },
}
it works for chromium, firefox and vlc but not for the xterms with the "-name" param. when i check the xterms after they started with xprop i can see:
WM_CLASS(STRING) = "5term", "XTerm"
i think that sould work, but the xterms are placed on the first workspace/tag.