Awesome: How do I vertically align an imagebox on the wibox?

Created on 15 Jan 2017  Â·  5Comments  Â·  Source: awesomeWM/awesome

Output of awesome --version:

_awesome v4.0 (Harder, Better, Faster, Stronger)
• Compiled against Lua 5.1.5 (running with Lua 5.1)
• D-Bus support: ✘
• execinfo support: ✔
• RandR 1.5 support: ✘
• LGI version: 0.9.1_

Question: How do I vertically align an imagebox on the wibox?

Sorry for the noob question, as this probably isn't hard, but I can't seem to figure this one out...

Currently, I have this:

offset icon

I want this:

centered icon

So, how would I go about doing this?

All 5 comments

I was able to solve this by making a black image that was 20px wide and 10px tall. Then I used the following code:

{
    layout = wibox.layout.fixed.vertical,
    x20x10,
    myshswitch,
}

in place of my headphones imagebox:

myshswitch,

Though I am still curious. Is there a more elegant way to accomplish this?

This could be achieved with margin layout (container) following way:

brightness_icon = wibox.widget {
{
    widget = wibox.widget.imagebox,
    image = "/usr/share/icons/Arc/status/symbolic/display-brightness-symbolic.svg",
    resize = false,
    },
    layout = wibox.container.margin(brightness_icon, 0, 0, 2)
}

Not sure about the syntax correctness though :)
For some reason this approach doesn't work with .png images...

margin worked! Thank you!

I don't know what issues you're having with .png images, but I'm able to get it to work with them.

myshswitch = wibox.widget.imagebox(profileConfigPath.."headphones2.png", false)
...
s.mywibox:setup {
...
  {
    myshswitch,
    layout = wibox.container.margin(myshswitch,0,0,3)
  },

Output:

2017-02-03-065244_1920x1080_scrot

Great! I'll retry with .png, maybe I missed something.

Was this page helpful?
0 / 5 - 0 ratings