For the new question:
Your code snippet doesn't work because you check if a client is visible, then toggle a random wibox (ok, not so random). The wibox will be shown and hidden many times are you do it for each client. So you end up with a ~50% change of getting back to the original state and ~50% change of having no wibox and no way to get it back.
I will expand on the last part of my previous answer as it is now the question.
What you want:
- Hide the wibar (
mywibox
) when rofi starts
- Hide All clients when rofi starts
- Restore the wibar when rofi exists
- Maybe display the tag again (or not, up to you).
The problems are:
- You don't know when rofi exits
- You don't know when rofi appears
- You don't know the names of the things you wish to hide
- You need to hide tags and the wibar
Problem 3:
Not your fault, the 3.5 has no documentation about this and the wiki was equally confusing.
- An
awful.wibox
(now renamed wibar) is the thing at the top of the screen
- A
wibox
is a random free floating widget on the screen. A wibar is a type of wibox acting like a panel.
- A client is a window on the screen
- A tag is similar to a virtual workspace
Problem 2:
This one is tricky. When you launch a command, there is a delay between that and when the application appears. There is ways to detect it, but they are not trivial. For now you can ignore this problem.
Problem 1:
This is the one you really have to solve. Awesome 3.5 does not have a good API to keep track of the life cycle from a command to the exit of the application. Awesome 4.0 is a little bit better, but this is an hard problem to solve. However, you should be able to know the class
of rofi (using xprop
). Once you know that, you can simplify the problem by only caring "do an event when rofi exits". The code for this is:
client.connect_signal("unmanage", function(c)
if c.class == "whatever_its_class_is" then
-- watch out of you have multiple screens, this may be too simplified.
mywibox[mouse.screen].visible = true
-- show the first tag, change this to what you prefer
awful.tag.gettags(mouse.screen)[1].selected = true
end
end)
Problem 4:
The simple way to hide the current tag (assumes you have 1 screen and 1 selected tag for the sake of simplicity)
awful.tag.selected().selected = false
Hide the main wibar (assuming you kept the default name)
mywibox[mouse.screen].visible = false
Original answer: (the question has changed)
Well, c
is just a variable. In this case, you never defined it, so it's nil
.
I guess you want all currently visible client. To check that, use client:isvisible().
You can loop across all clients using
for _, c in ipairs(client.get()) do
if c:isvisible() then
-- do something
end
end
As shown in the client documentation (https://awesomewm.org/apidoc/classes/client.html [1])
That being said, I don't see how the description and the question/code fit. If you want to hide everything, then unselect all tags and hide the wibar. Messing with the titlebars (the thing on top of clients) seem rather unnecessary.
[1] The link is for Awesome 4.0, but in this case isn't very different from the 3.5 API.