On Tue, Oct 30, 2012 at 11:14 PM, Manuel Kasser <manuel.kas...@arcor.de>wrote:
> Hi, > I again need your advice. > The situation is, I have two machines running awesome and I want to > externalize every machine-specific part of my rc.lua so I just have to > sync my rc.lua upon changes and do not have to adapt it. > > Part of this plan is that both computers shall use a different set of > widgets (e. g. I don't need a battery widget on a stationary system). > > mspec is the file with the machine-specific parts of code, the widgets > itself are working well and are created inside the mspec-Methods. > > At the moment, my wibox is constructed like this: > --variant 1: > mywibox[s].widgets = { > { > --launcher, taglist, promptbox > }, > mylayoutbox[s], > mytextclock, > --MyWidgets > mspec.volwidget(), --Volwidget > mspec.netwidget(), --Netwidget > mspec.memtxtw(), --Memory-Widget > mspec.cputxtw(), --CPU-Widget > You can change these methods to return nil if you don't want the widget to appear. Or if you want to move that logic into rc.lua, you can use variables: myvolwidget = <condition> and mspec.volwidget() or nil > --EndMyWidgets > s == 1 and mysystray or nil, > mytasklist[s], > layout = awful.widget.layout.horizontal.rightleft > } > > My idea was that I want to get an array of widgets by calling > mspec.getWidgets() --returns { volwidget , memorywidget , cpuwidget } > and cycle over this array and insert these widgets into my wibox. > I tried: > --variant 2: > wid = mspec.getWidgets() > > mywibox[s].widgets = { > { > --launcher, taglist, promptbox > }, > mylayoutbox[s], > mytextclock, > --MyWidgets > wid, > --EndMyWidgets > s == 1 and mysystray or nil, > mytasklist[s], > layout = awful.widget.layout.horizontal.rightleft > } > > The problem with variant 2 is that the widgets aren't placed where the > widgets were placed in variant 1, between mytextclock and mytasklist, > but between the first array with the taglist and the promptbox and the > tasklist. > > Does anyone have an idea how I could implement this intelligently > (preferred by using "mspec.getWidgets()" and its array)? A for-loop to > cycle over the array does not work inside an array, of course. > > Thanks in advance! > Manuel > > -- > To unsubscribe, send mail to awesome-unsubscr...@naquadah.org. >