Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to add this to the wibar? #9

Closed
wucke13 opened this issue Apr 10, 2017 · 4 comments
Closed

How to add this to the wibar? #9

wucke13 opened this issue Apr 10, 2017 · 4 comments

Comments

@wucke13
Copy link
Contributor

wucke13 commented Apr 10, 2017

Using right_layout:add(battery.widget) throws an error cause there is no object right_layout. How may I add it to the wibar, after initial setup?

@coldfix
Copy link
Member

coldfix commented Apr 10, 2017

depends how your rc.lua looks like. The current default contains a section which looks like:

    awful.titlebar(c) : setup {
        { -- Left
            ...
        },
        { -- Middle
            ...
        },
        { -- Right
            ...
        },
        layout = wibox.layout.align.horizontal
}

you can insert battery.widget there as you like it.

The usage example from the README is from a time where the default looked different, I believe.

@coldfix
Copy link
Member

coldfix commented Apr 10, 2017

Oh, forget what I said! This is for the client titlebars, not the wibox.

Instead, look for:

s.mywibox:setup {

        layout = wibox.layout.align.horizontal,
        { -- Left widgets
            ...
        },
        s.mytasklist, -- Middle widget
        { -- Right widgets
            ...
        },
}

@wucke13
Copy link
Contributor Author

wucke13 commented Apr 10, 2017

I know that I can add it this way, however I would like to add it after the initial run of s.mywibox:setup. Is that still possible? The reason is that I use the same rc.lua for both desktop and laptop. I wrote a little lua snippet which finds out on which device I am, now I would like to add it to the wibox.

@coldfix
Copy link
Member

coldfix commented Apr 10, 2017

Oh. Well, you can restructure your init code like this:

  local right_layout = {
      ...
  }
  if laptop then table.insert(right_layout, battery.widget) end
  s.mywibox:setup {
      layout = wibox.layout.align.horizontal,
      left_layout,
      nil,
      right_layout,
  }

Or just look into the awesome documentation.

@coldfix coldfix closed this as completed Apr 10, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants