Wednesday 14 November 2012

Awesome WM: Remove Border from Maximized Windows

I am currently using quite a bright theme with my Awesome WM on Linux and the borders of an active window are of quite a bright blue color. While this really helps in easily identifying the active window in a tiled layout (i.e. with several terminal windows side by side), such a bright border can become a nuisance when it appears at all times around a maximized window such as Firefox.

Here is a simple workaround to remove the border from maximized windows and put it back when a window is unmaximized:

Replace this line:
client.add_signal("focus", function(c) c.border_color = beautiful.border_focus end) 

with the following code:
client.add_signal("focus",
        function(c)
                if c.maximized_horizontal == true and c.maximized_vertical == true then
                        c.border_width = "0"
                        c.border_color = beautiful.border_focus
                else
                        c.border_width = beautiful.border_width
                        c.border_color = beautiful.border_focus
                end
        end)



The apparent shortcoming is that the window must have to be focused at least once for this to work - I haven't found a better hook other than focus to attach the code to.

2 comments:

  1. Thank you, this works well and is very helpful :)

    The only quirk is that now (in awesome 3.5 at least) you have:

    client.connect_signal

    instead of:

    client.add_signal

    ReplyDelete
    Replies
    1. Thanks for the comment!
      I wrote this when 3.5 was not yet announced and even now I still haven't migrated to it. Whenever I will, I will make sure to update the post.

      Delete