Ubuntu – In Awesome window manager, how to add vicious widgets

awesomewidgets

I do exactly what it says in the vicious README, but when I reload the configuration file, no widgets are added to the top bar. So for example, I add:

require("vicious")

at the top (after moving the vicious directory in ~/.config/awesome/) and:

-- Initialize widget
cpuwidget = widget({ type = "textbox" })
-- Register widget
vicious.register(cpuwidget, vicious.widgets.cpu, "$1%")

later in the config file. I reload the configuration file, and nothing changes.

What am I doing wrong?

Best Answer

You've created and registered the widget, but you've not actually told Awesome where to put the widget. You might assume it should know you want it in the default "panel", but actually you can put it in other places (like if you set up a second panel at the bottom).

In the default rc.lua (and yours hopefully, if it's not been too customized), there should be a part that says something about creating a wibox:

 -- Create the wibox
 mywibox[s] = awful.wibox({
         fg = beautiful.fg_normal, bg = beautiful.bg_normal,
         border_color = beautiful.border_focus,
         --border_width = beautiful.border_width,
         position = "top",
         --height = 20,
         screen = s
         })

[Note there is an 's' variable due to that portion being in a 'for' loop. Same for the next code block below. ] Then you add the widgets you've defined to the wibox as follows:

 -- Add widgets to the wibox - order matters
 mywibox[s].widgets = {
     {
         mylauncher,
         mytaglist[s], spacer,
         mylayoutbox[s],
         layout = awful.widget.layout.horizontal.leftright
     },
     mytextclock, separator,
     volwidget, volicon, separator,
     mailinfo, mailicon, separator,
     s == 1 and mysystray or nil,
     separator, upicon, netwidget, dnicon,
     -- mytasklist[s],
     layout = awful.widget.layout.horizontal.rightleft
 }

These are not all vicious widgets but some default ones and ones I've defined. I have one set of widgets starting from the left edge of the screen and another starting from the right edge. My tasklist used to be in the middle of the panel but I've commented it out, since now I put a tasklist on a bottom panel and use conky in the middle of the top panel.