Search code examples
luacustomizationwindow-managersawesome-wm

How to hide all clients in all tags in AwesomeWM?


I am trying to add to my rc.lua a function that hides (or minimizes) all clients in all tags in AwesomeWM, just like one can do in Windows with Aero Peek or in GNOME with the 'Show Desktop' extension (as respectively seen on the images):

enter image description here

enter image description here

Basically I'm looking for a Lua code snippet, which I think it should look like:

awful.key({ modkey }, "l",
                  function ()
                     -- for every client in AwesomeWM...
                     myscreen.client.visible = false,       
                  end
end,

Note that this is just a suposition, this code is not working. It's a skeleton of what I initially think the answer could be, added for clarifying purposes.

Technical information:

awesome v4.0-170-g6c24848-dirty (Harder, Better, Faster, Stronger)
 • Compiled against Lua 5.3.3 (running with Lua 5.3)
 • D-Bus support: ✔
 • execinfo support: ✔
 • xcb-randr version: 1.5
 • LGI version: 0.9.2

Solution

  • Some variations of:

    mouse.screen.selected_tag.selected = false
    

    Will work. If you choose to support multiple selected tags, then for _, t in ipairs(mouse.screen.selected_tags) do t.selected = false end will be better. If you choose to show the desktop on all screens, then you need to loop them too. You could also save the previously selected tags to be able to restore them when you click on the button twice.

    Relevant API doc: