You are not logged in.

#1 2009-08-11 13:32:44

UQ-igor
Member
Registered: 2009-03-05
Posts: 42

Awesome dual screens widget placement

Hi,

After getting dual screens to work, I'm trying to get awesome configured for dual screens which is proving challenging since there are still parts of rc.lua I don't completely understand.

Anyway, I log in, then I use xrandr commands to turn on the second screen and set the resolutions correctly. I would like all widgets to display on the primary screen, and only taglist and tasklist to display on the second screen, but I'm not sure how to do this. I tried a couple of things which resulted in awesome putting a statusbar on only one screen - not what I wanted! I also found one example of rc.lua for dual screen setup, but it didn't implement what I'm after.

Anyway, relevant part of rc.lua:

 -- Add widgets to the wibox (order matters)
    statusbar[s].widgets = { spacer, 
               layoutbox[s],
                           spacer,
               taglist[s],
               spacer,
                           separator,
                           promptbox[s],
                           separator,
               cpuwidget,
               separator,
               cpufreqwidget,
                           separator,
               memwidget,
                           separator,
               thermalwidget,
                           separator,
               batwidget,
                           separator,
               tasklist[s],
                           dateicon,
               datewidget,
                           s == screen.count() and systray or nil
    }
    statusbar[s].screen = s

I know 's' refers to the screen number, but changing the above to:

 -- Add widgets to the wibox (order matters)
    statusbar[1].widgets = { spacer, 
               layoutbox[1],
                           spacer,
               taglist[1],
               spacer,
                           separator,
                           promptbox[1],
                           separator,
               cpuwidget,
               separator,
               cpufreqwidget,
                           separator,
               memwidget,
                           separator,
               thermalwidget,
                           separator,
               batwidget,
                           separator,
               tasklist[1],
                           dateicon,
               datewidget,
                           s == screen.count() and systray or nil
    }
    statusbar[2].widgets = {spacer,
                                      taglist[2],
                                      tasklist[2]
}
    statusbar[s].screen = s

puts awesome statusbar only on the primary screen. So, any help with this would be greatly appreciated!

Cheers,
-Igor

Offline

#2 2009-08-11 13:39:44

Crows
Member
From: Wales
Registered: 2008-09-05
Posts: 92

Re: Awesome dual screens widget placement

Don't use multi-screen setup here, but I'm fairly positive you need to make 2 seperate statusbars and add them to each screen seperately. Are you doing that?

So, something along the lines of (pseudo-code):

statusbar1 = wibox(properties)

statusbar2 = wibox(properties)

widgets defined here

statusbar1.widgets = {the widgets you want on screen one}

statusbar2.widgets = {the ones you want on screen two}

statusbar1.screen = 1
statusbar2.screen = 2

Should point you in the right direction. Like I said, though. Don't use multi-screen setup, so this might not work that well.

Offline

#3 2009-08-12 03:09:00

UQ-igor
Member
Registered: 2009-03-05
Posts: 42

Re: Awesome dual screens widget placement

Thanks for the tip Crows,

I played around with rc.lua a bit more and got it working with the code below (for future referene if anybody is having the same probs). I am not sure if this is the correct way to do it, but it works for me for the time being.

   -- Add widgets to the wibox (order matters)
    if (s == 1) then
    statusbar[s].widgets = { spacer, 
                    layoutbox[s],
                    spacer,
                    taglist[s],
                    spacer,
                    separator,
                    promptbox[s],
                    separator,
                    cpuwidget,
                    separator,
                    cpufreqwidget,
                    separator,
                    memwidget,
                    separator,
                    thermalwidget,
                    separator,
                    batwidget,
                    separator,
                    tasklist[s],
                    dateicon,
                    datewidget,
                    s == screen.count() and systray or nil
                }
    else
    statusbar[s].widgets = {spacer,
                layoutbox[s],
                spacer,
                taglist[s],
                spacer,
                seperator,
                promptbox[s],
                seperator,
                tasklist[s],
                s == screen.count() and systray or nil
                }
    end
    statusbar[s].screen = s

Basically, I just added an if-then-else-end statement when adding widgets to statusbar/screens.

-igor

Offline

#4 2009-08-12 10:42:00

anrxc
Member
From: Croatia
Registered: 2008-03-22
Posts: 834
Website

Re: Awesome dual screens widget placement

Default rc.lua is already setup for multiple screens, it uses a loop to do it. Why would you change that.

for s = 1, screen.count() do
    -- promptbox...
    -- layoutbox...
    -- ...
    mywibox[s].widgets = { mylauncher,
                           mytaglist[s],
                           mytasklist[s],
                           mypromptbox[s],
                           mytextbox,
                           mylayoutbox[s],
                           s == 1 and mysystray or nil
    }

See how the systray is supposed to be shown only on screen 1. You can do the same for other widgets.

Last edited by anrxc (2009-08-12 10:42:55)


You need to install an RTFM interface.

Offline

Board footer

Powered by FluxBB