Search code examples
luaawesome-wm

awesome-wm: How to change systray shape


Is there any way to change the systray shape to rounded rectangle in AwesomeWM window manager? I've searched docs for "wibox.widget.systray" class but it doesn't have option to change it's shape. I tried to put systray to container and set the shape there but it didn't work:

s.mysystray = wibox.widget.systray()
local systray_container = wibox.container.background(s.mysystray, beautiful.bg_systray, gears.shape.rounded_rect)
local systray_margin = wibox.container.margin(systray_container, 0, 0, 5, 5)
local systray = wibox.container.place(systray_margin, {
    halign = "center",
    fill_vertical = true,
})

I would like to unify systray with tasklist selection just like in the picture below: https://i.sstatic.net/buHBW.jpg


Solution

  • You can! To achieve this, you must use the Awesome "container" pattern and wrap it into a wibox.container.background.

    -- the systray has its own internal background because of X11 limitations
    beautiful.bg_systray = "#ff0000"
    beautiful.systray_icon_spacing = 10
    
    local my_round_systray = wibox.widget {
        {
            wibox.widget.systray(),
            left   = 10,
            top    = 2,
            bottom = 2,
            right  = 10,
            widget = wibox.container.margin,
        },
        bg         = "#ff0000",
        shape      = gears.shape.rounded_rect,
        shape_clip = true,
        widget     = wibox.container.background,
    }
    

    Please note that background handling within the systray widget is limited. It cannot be a gradient or a transparent color. This is due to X11 limitations. Awesome doesn't have an internal compositing manager and instead rely on external ones such as Compton. One of the downside of doing this is the systray. The upside is, well, everything else. Also, both Qt and GTK apps keep regressing their systray background support. The bug is on their side and cannot be mitigated for non-compositing WMs without implementing non-standard-compliant hacks, which AwesomeWM will not do. So you end up with:

    enter image description here