awesomeWM / awesome

awesome window manager
https://awesomewm.org/
GNU General Public License v2.0
6.36k stars 598 forks source link

Inconsistent border behaviour when maximizing clients and reloading awesome. #2103

Open ghost opened 6 years ago

ghost commented 6 years ago

Related to #2089

Output of awesome --version:

awesome v4.2-170-gf3f0f42b (Human after all) • Compiled against Lua 5.3.4 (running with Lua 5.3) • D-Bus support: ✔ • execinfo support: ✔ • xcb-randr version: 1.5 • LGI version: 0.9.2

How to reproduce the issue:

Expected result:

Borders would either always be visible, or always not visible on maximized (and those lying on max tags) clients. Possibly add maximized_border_width theme property?

psychon commented 6 years ago

Maximize any floating (or on floating tag) client. Borders are not visible.

That must be something in your config. It's not awesome's doing. Could that also cause the whole problem?

ghost commented 6 years ago

The thing is that i copy default rc.lua, add beautiful.border_width = 5 at line 49 and this happens. It is also indeed inconsistent and sometimes border completely disappear on maximizing.

ghost commented 6 years ago

So, after a fresh reboot with vanilla rc.lua extept border_width. I've opened and maximized luakit with this issue open so i'm typing the text right now.

Repeated same actions with termite. When remaximizing after restart, not only borders are gone, but in maximized state there is also a gap at right and bottom sides between client and screen edge. On the right the gap is equal to border width, and on the bottom to two border widths. Remember that this client still has no borders.

It is noticeable even with completely default rc.lua and one-pixel borders. Everything works fine after booting before the first restart. To make borders for the client work again as they should - reload awesome with client being demaximized.

psychon commented 6 years ago

Everything is still the same. Demaximizing the window (Super+m). Now borders are gone. Indeed gone,

@necauqua Now I'm a bit confused. Maximizing a client should not change the border width, should it? Only fullscreen clients have their border hidden. So how do you end up with a border width of 0?!?

@Elv13 Uhm, a fullscreen client across a restart will be made fullscreen again after restart before manage ran and thus before the border width of the theme was applies. At this time, the client has a border width of 0 and thus this is what will be restored after un-fullscreen-ing...

Elv13 commented 6 years ago

@Elv13 Uhm, a fullscreen client across a restart will be made fullscreen again after restart before manage ran and thus before the border width of the theme was applies. At this time, the client has a border width of 0 and thus this is what will be restored after un-fullscreen-ing...

That can be changed, but it will require careful testing. I guess applying those from the rules would make at least logical sense. It could be incorporated using #1487 to the client rules set.

ghost commented 6 years ago

@psychon That is the bug as this definitely shouldn't happen.

ghost commented 5 years ago

I have a similar error, sometimes and in some clients like emacs, firefox the border disappear when maximizing the window and when I unmaximizing the border never reappear, I fixed it with:

   awful.key({ modkey,           }, "m",
      function (c)
         c.maximized = not c.maximized
         c.border_width = beautiful.border_width -- fix border 
         c:raise()
      end, {description = "(un)maximize", group = "client"}),

or

client.connect_signal("property::size", function(c) c.border_width = beautiful.border_width end)
gitaarik commented 1 year ago

Also faced this issue, and this work-around seems to work good for me:

client.connect_signal("property::size", function(c) c.border_width = beautiful.border_width end)

But it does seem like some kind of rendering issue in Awesome-WM. Hope it can get fixed at some point down the line.

gitaarik commented 1 year ago

I actually had to add some conditions to remove a border in fullscreen video view in firefox:

client.connect_signal("property::size", function(c)
    if not c.maximized and not client.fullscreen then
        c.border_width = beautiful.border_width
    end
end)
gitaarik commented 1 year ago

However, the issues still happens when you puta youtube video in fullscreen in a floating firefox window. I see a border on the left side.

gitaarik commented 1 year ago

I now found another method which seems to not have this issue:

client.connect_signal("request::geometry", function(c)
    if not c.maximized and (not client.focus or not client.focus.fullscreen) then
        c.border_width = beautiful.border_width
    end
 end)

Inspired by https://github.com/awesomeWM/awesome/issues/1692#issuecomment-570734265

gitaarik commented 1 year ago

Actually, it works with the property::size signal too. The trick is to not fix the borders when the focussed client is fullscreen, because that causes the issue of having a border on the left side on fullscreen youtube.

actionless commented 1 year ago

i think the issue here is how manage signal works - as a workaround in my config i have this hack:

  client.disconnect_signal("request::manage", ruled.client.apply)
  client.connect_signal("request::manage", function(c)
      if awesome.startup then
          local rules = ruled.client.matching_rules(c, ruled.client.rules)
          for _,rule in ipairs(rules) do
              if rule.apply_on_restart then
                  ruled.client.execute(c, rule.properties, { rule.callback })
              else
                  local mini_properties = {}
                  for _, prop in ipairs({
                    "buttons",
                    "keys",
                    "size_hints_honor",
                    "raise",
                  }) do
                    if rule.properties[prop] ~= nil then
                      mini_properties[prop] = rule.properties[prop]
                    end
                  end
                if #(g_table.keys(mini_properties)) > 0 then
                  ruled.client.execute(c, mini_properties, { })
                end
              end
          end
      else
          ruled.client.apply(c)
      end
    local awesome_startup = awesome.startup
    delayed_call(function()
        if c == client.focus then
          if awesome_startup then
.........
          end
        else
            if awesome_startup then
............
            end
        end
    end)
  end)