I made a change in my rc.lua
to always open Chromium on screen 2:
awful.rules.rules = {
-- many other rules here...
-- Set Chromium to always map on screen "2"
{ rule = { class = "Chromium" },
properties = { screen = 2 } },
}
However, when I do not have an external monitor attached, I get an error ("screen expected, got nil"). How do I modify this rule to use screen 1 if screen 2 is not available?
The following assumes you have only two or one screens. It does the wrong thing when there are more screens, but it should get the idea across:
properties = { screen = function() return screen.count() end }
All(?) properties in awful.rules
can also be specified as a callback function. This function even gets the client (and the table of collected properties?) as argument (but this is not used in this example).