Systray Hide/Show

Here I will explain how to make a keybinding that toggles the visibility of the systray. I've only tested this in awesome v3.5.4. Here's the thread I got the main bits from

The Code
In the beginning of your rc.lua you'll want to add these lines:

stupid_bug = drawin({}) systrayvisible = true systray = wibox.widget.systray container = wibox.layout.constraint container:set_widget(systray) container:set_strategy("min") container:set_width(4)

Then in the main screen.count loop, put these lines

if s == 1 then left_layout:add(container) end

Where left_layout is whatever wibox or layout you want to put the systray.

Then in your global_keybindings table, you want to add this rule:

awful.key({ modkey,          }, "s", function     if systrayvisible then     awesome.systray(stupid_bug, 0, 0, 10, true, "#000000")     container:set_widget(nil)     container:set_strategy("exact")     systrayvisible = false   else     container:set_strategy("min")     container:set_widget(systray)     systrayvisible = true   end end),

How does it work???
Essentially the systray is put into a dummy "container" layout, and taken out when hidden. The `awesome.systray(stupid_bug, 0, 0, 10, true, "#000000")` line is some crazy voodoo that actually makes the widget go away. When the widget is hidden, the container becomes 4px wide thanks to container:set_width(4). You can set this to 1 if you want, I only have space because the icons I use for my taglist and and tasklist are the same. The padding prevents confusion when the systray is hidden.