Am 13.01.2011 01:10, Torsten Wagner wrote:
On 01/13/2011 03:12 AM, Adrian C. wrote: > On Wed, 12 Jan 2011, Torsten Wagner wrote: > >> Applying an awful.rule with a property tags[2][2] fails for Xephyr but >> works for my dual screen on the "real" system. > > Don't hard code the number of screens. Use 'screen.count()' instead of > the maximum number. > > Don't write code to make assumptions about the screen number either... > then you can have 1 or 4 screens and your rc.lua work the same way. >Hi Adrian, thanks for mailing the problem in that particularity case is already given in the shipped rc.lua. Mainly these few lines (completely stripped down to the basic point) for s = 1, screen.count() do -- Each screen has its own tag table. tags[s] = awful.tag({ 1, 2, 3, 4, 5, 6, 7, 8, 9 }, s, layouts[1]) ... -- Set Firefox to always map on tags number 2 of screen 2. { rule = { class = "Firefox" }, properties = { tag = tags[2][2] } }, As you see I set Firefox to screen 2 tag 2. This actually creates the error in Xephyr. To avoid hard coding at that point is perfectly possible chaining it to tag = tags[screen.count()][2] but might become a bit difficult to read or unpredictable if you share your rc.lua between different systems with different number of screens
[...] How about something like this: if screen.count() == 1 then screen_one = 1 screen_two = 1 else screen_one = 1 screen_two = 2 end Then you use tag=tags[screen_two][2] in your rule. This would be extensible to more than two screens, too. Cheers, Uli -- To unsubscribe, send mail to [email protected].
