mut-ex / awesome-wm-nice

An Awesome WM module that add MacOS-like window decorations, with seamless titlebars, double click to maximize, and window shade feature
MIT License
469 stars 31 forks source link

Weird bottom margin when trying to disable titlebar on maximize #10

Closed Pablo1107 closed 4 years ago

Pablo1107 commented 4 years ago

I'm trying to hide the titlebar when the window is maximized so I can have full real state when I need it, or fancy titlebars when I don't.

In my rc.lua I have this code:

client.connect_signal("request::geometry", function(c)
  if c.maximized then
      awful.titlebar.hide(c)
  else
      awful.titlebar.show(c)
  end 
end)

The undesired behavior:

image image

Pablo1107 commented 4 years ago

Ok... this issue is related to the way I handle the hiding of the titlebar and not with nice.

Closing, but if anyone knows how to accomplish this without that weird bottom margin, let me know.

mut-ex commented 4 years ago

@Pablo1107 I have experienced this issue before and never really looked into it too much. It almost seems like the window geometry isn't updated to expand to fill the space available after removing the titlebar. You can see the space left at the bottom is the size of the titlebar. A hack I use to get rid of this issue is to forcibly set the window geometry when it is maximized. Connect a signal to the maximized property and set x and y to 0 and width and height to screen width and height accordingly.

Pablo1107 commented 4 years ago

@Pablo1107 I have experienced this issue before and never really looked into it too much. It almost seems like the window geometry isn't updated to expand to fill the space available after removing the titlebar. You can see the space left at the bottom is the size of the titlebar.

Yep, it's seems it runs the hide function but set the width and height assuming the titlebar is present. Maybe this is an issue which should be fixed upstream, but I wouldn't be qualified to try fix it. lol

A hack I use to get rid of this issue is to forcibly set the window geometry when it is maximized. Connect a signal to the maximized property and set x and y to 0 and width and height to screen width and height accordingly.

What do you mean with this? I already have a connect_signal on request::geometry. Should I add there the forced resizing?

mut-ex commented 4 years ago

@Pablo1107 Check out the latest commit. I added an option to disable titlebars for maximized windows. There are no gaps around the window.

Pablo1107 commented 4 years ago

Thanks @mut-ex. I notice you added that option, but as you used the screen resolution to set the width and height it goes over the statusbar. I actually end up using this on my rc.lua:

    awful.key({ modkey,           }, "m",
        function (c)
            if not c.maximized then
                awful.titlebar.hide(c)
            end 
            c.maximized = not c.maximized
            c:raise()
            if not c.maximized then
                awful.titlebar.show(c)
            end
        end ,
        {description = "(un)maximize", group = "client"}),
Pablo1107 commented 4 years ago

Actually, I found that awesome offers the screen workarea to work around the statusbar, I made a PR to fix that as well.

mut-ex commented 4 years ago

Thanks for the fix! I merged it