You are not logged in.

#1 2011-02-23 11:48:56

gray85
Member
Registered: 2010-11-27
Posts: 14

[SOLVED] awesome border_width

Hi All!

I use theme.border_width  = "1". But I want a maximized and fullsrceen window to has border_width  = "0" so I wrote this trcik:

    awful.key({ modkey,           }, "m",
        function (c)
            if c.maximized_vertical then
              c.border_width = 1
            else
              c.border_width = 0
            end
            c.maximized_horizontal = not c.maximized_horizontal
            c.maximized_vertical   = not c.maximized_vertical
        end)

But there is a problem: when an application starts already in maximized state it has a border = "1".

How can it be solved? Maybe by signals?

Last edited by gray85 (2011-02-27 09:18:12)

Offline

#2 2011-02-23 21:29:32

anrxc
Member
From: Croatia
Registered: 2008-03-22
Posts: 835
Website

Re: [SOLVED] awesome border_width

Do it all in the arrange signal. You can add it to the bottom of your rc.lua

-- {{{ Arrange signal handler
for s = 1, screen.count() do screen[s]:add_signal("arrange", function ()
    local clients = awful.client.visible(s)

    for _, c in pairs(clients) do
        if   #clients == 1 then clients[1].border_width = 0
        else c.border_width   =  beautiful.border_width end
    end
  end)
end
-- }}}

Last edited by anrxc (2011-02-23 21:31:15)


You need to install an RTFM interface.

Offline

#3 2011-02-24 18:49:19

gray85
Member
Registered: 2010-11-27
Posts: 14

Re: [SOLVED] awesome border_width

anrxc, thank you! but it does not work for me, nothing happens... When I start firefox, it starts in maximized state, but it has a border.

Unfortunately I do not know what "arrange" signal does and do not understand what "for _, c in pairs(clients)" means sad

Offline

#4 2011-02-24 22:12:47

greyscale
Member
From: Sweden
Registered: 2011-01-02
Posts: 59

Re: [SOLVED] awesome border_width

Been thinking of the same thing but never got around to give it a go before...

gray85:
Anrxc tip didn't work for me either but I suspected that conky might be the reason by being counted as a client so that #clients == 0
would only be true for a "empty" screen.

If your running conky or something like it thst might be the reason.

I fixed it by setting

 own_window_type override 

in ~/.conkyrc

Then I merge yours and anrxc tips into this:

-- No border if maximized or the only window showing.
-- Set own_window_type override in .conkyrc or it will be counted as a client
for s = 1, screen.count() do screen[s]:add_signal("arrange", function ()
    local clients = awful.client.visible(s)
                                                                                                                                                            
    for _, c in pairs(clients) do
        if c.maximized_horizontal and c.maximized_vertical then
            c.border_width = 0 
        elseif #clients == 1 then
            c.border_width = 0 
        else
            c.border_width = beautiful.border_width
        end 
    end 
  end)
end

So thanks to both of you for giving me the motivation to finally do it smile


A tiling window manager simply manages your windows, not just letting you have em
:: Configs etc @GitHub

Offline

#5 2011-02-26 03:47:59

anrxc
Member
From: Croatia
Registered: 2008-03-22
Posts: 835
Website

Re: [SOLVED] awesome border_width

I was cutting a few corners there, yeah, just to get you going. Maximized means only it is visible, but then what is the difference when you only have one normal client, or a fullscreen client... why loose those pixels. A proper solution counts in things like a floating client above a maximized client... (think dialog), and your conky too smile


You need to install an RTFM interface.

Offline

#6 2011-02-26 09:10:54

gray85
Member
Registered: 2010-11-27
Posts: 14

Re: [SOLVED] awesome border_width

greyscale, thank you! smile Now it works. But there is a problem with VLC and smplayer now sad When I hit super+m:

    awful.key({ modkey,           }, "m",
        function (c)
            c.maximized_horizontal = not c.maximized_horizontal
            c.maximized_vertical   = not c.maximized_vertical
        end)

VLC maximizes but there are some pixels on a right and bottom...

When does "arrange" signal come?

Offline

#7 2011-02-26 09:50:54

anrxc
Member
From: Croatia
Registered: 2008-03-22
Posts: 835
Website

Re: [SOLVED] awesome border_width

Are you sure you are ignoring size hints? Read the FAQ on awesome wiki, it will do you good. Signals page should have an answer to your last question.


You need to install an RTFM interface.

Offline

#8 2011-02-27 09:17:48

gray85
Member
Registered: 2010-11-27
Posts: 14

Re: [SOLVED] awesome border_width

anrxc, there is no answer about "arrange" here https://awesome.naquadah.org/wiki/Signals sad
"size_hints_honor = false" helps smile Thank you very much!

Offline

#9 2011-03-03 17:48:33

greyscale
Member
From: Sweden
Registered: 2011-01-02
Posts: 59

Re: [SOLVED] awesome border_width

gray85:
Your right about that.

Haven't checked the source but "arrange" is emitted when changing tag, adding and removing clients (at least) so
it seems to be done when awesome "arranges" the clients on screen or how to say wink


A tiling window manager simply manages your windows, not just letting you have em
:: Configs etc @GitHub

Offline

Board footer

Powered by FluxBB