You are not logged in.

#1 2010-07-22 02:49:35

melanogaster
Member
Registered: 2010-07-22
Posts: 9

Toggling titlebars in awesome

My first post big_smile. I have been a long time reader of this amazing forum, it has been invaluable to me. I am a bit of newb as I only installed my first distro about 2 months ago, but I am learning.
I have been trying to toggle the window titlebars in awesome wm, so that floating windows have them, but non floating windows don't. I think you can do it through signals but I can't find a lot of information on how exactly they work and my lua knowledge is extremely limited. If anyone could point me toward the right way of going about doing this it would be awesome (pun intended).

Last edited by melanogaster (2010-07-31 05:10:33)


studio 1558: ubuntu 10.04 awesome wm, gnome, & xmonad ;
ancient frankensteinish desktop computer: arch awesome wm;

Offline

#2 2010-07-22 03:04:23

Intrepid
Member
Registered: 2008-06-11
Posts: 254

Re: Toggling titlebars in awesome

I believe that I wrote a hook and published it in these forums to have active with window borders and non-active windows without them.  It should be fairly simple to change this code into the hooks for floating/nonfloating, and to work with changing titlebars, but I don't really use awesome anymore.  Try searching the forums, there are a lot of posts about Awesome.


Intrepid (adj.): Resolutely courageous; fearless.

Offline

#3 2010-07-22 03:42:12

melanogaster
Member
Registered: 2010-07-22
Posts: 9

Re: Toggling titlebars in awesome

hey thanks. I found your post, but a lot of the config syntax has changed since then. Hooks seem to have been replaced by signals and several of the sections you referenced don't appear to exist anymore. sad I just found some information on signals though so I am reading that.


studio 1558: ubuntu 10.04 awesome wm, gnome, & xmonad ;
ancient frankensteinish desktop computer: arch awesome wm;

Offline

#4 2010-07-22 15:16:53

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

Re: Toggling titlebars in awesome

See my manage signal for a start... then if you can read rc.lua find other titlebar related tweaks in the key bindings http://git.sysphere.org/awesome-configs/tree/rc.lua


You need to install an RTFM interface.

Offline

#5 2010-07-22 18:08:21

Intrepid
Member
Registered: 2008-06-11
Posts: 254

Re: Toggling titlebars in awesome

melanogaster wrote:

hey thanks. I found your post, but a lot of the config syntax has changed since then.

That's part of why I no longer use awesome, even though it was awesome big_smile


Intrepid (adj.): Resolutely courageous; fearless.

Offline

#6 2010-07-24 18:39:42

melanogaster
Member
Registered: 2010-07-22
Posts: 9

Re: Toggling titlebars in awesome

Ok so I sort of solved the problem. I added this line to client.add_signal("manage", function (c, startup) 

if (awful.layout.get(c.screen) ==  awful.layout.suit.floating) 
   then
    awful.titlebar.add(c, { modkey = modkey })
   end

And then bellow client.add_signal("unfocus", function(c) c.border_color = beautiful.border_normal end)

client.add_signal("focus", function(c)  if awful.layout.get(c.screen) ==  awful.layout.suit.floating or awful.client.floating.get(c)
   then
    awful.titlebar.add(c, { modkey = modkey })
   else
    awful.titlebar.remove(c, { modkey = modkey })
   end
end)

client.add_signal("unfocus", function(c)  if awful.layout.get(c.screen) ==  awful.layout.suit.floating or awful.client.floating.get(c)
   then
    awful.titlebar.add(c, { modkey = modkey })
   else
    awful.titlebar.remove(c, { modkey = modkey })
   end
end)

So it checks if you need title bars whenever you mouse over it or start the window up.
@Intrepid I think once awesome settles down and stops making changes it will be like the compiz of tiling wms.


studio 1558: ubuntu 10.04 awesome wm, gnome, & xmonad ;
ancient frankensteinish desktop computer: arch awesome wm;

Offline

#7 2010-07-24 20:15:29

Barghest
Member
From: Hanau/Germany
Registered: 2008-01-03
Posts: 563

Re: Toggling titlebars in awesome

Good idea. I tried to achieve this, too but like my solution yours causes flicker when moving the mouse over clients , too and when switching between tags most of the time the titlebars are misplaced.

So, currently I just have every client undecorated smile

Offline

#8 2010-07-25 06:35:18

melanogaster
Member
Registered: 2010-07-22
Posts: 9

Re: Toggling titlebars in awesome

@Barghest I didn't notice any flickering or misplaced title bars. What version of awesome are you using? I am using 3.4.3 .


studio 1558: ubuntu 10.04 awesome wm, gnome, & xmonad ;
ancient frankensteinish desktop computer: arch awesome wm;

Offline

#9 2010-07-25 10:05:12

Barghest
Member
From: Hanau/Germany
Registered: 2008-01-03
Posts: 563

Re: Toggling titlebars in awesome

$ powerpill -Qs awesome
local/awesome 3.4.5-2

But this was the case with older versions, too. Maybe it's not an awesome issue?

Offline

#10 2010-07-27 22:31:50

melanogaster
Member
Registered: 2010-07-22
Posts: 9

Re: Toggling titlebars in awesome

What I don't get is why:

client.add_signal("property::floating", function(c)  if awful.layout.get(c.screen) ==  awful.layout.suit.floating or awful.client.floating.get(c) 
   then
    awful.titlebar.add(c, { modkey = modkey }) 
   else
    awful.titlebar.remove(c, { modkey = modkey }) 
   end
end)

doesn't work. This would seem to be the ideal method to do it too. :-(


studio 1558: ubuntu 10.04 awesome wm, gnome, & xmonad ;
ancient frankensteinish desktop computer: arch awesome wm;

Offline

#11 2010-07-27 22:50:23

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

Re: Toggling titlebars in awesome

You have to attach that to an actual client, see mouse::enter in your manage signal as example.


You need to install an RTFM interface.

Offline

#12 2010-07-28 01:48:08

melanogaster
Member
Registered: 2010-07-22
Posts: 9

Re: Toggling titlebars in awesome

You have to attach that to an actual client, see mouse::enter in your manage signal as example.

Do you mean something like this?

client.add_signal("manage", function (c, startup)
    -- Add a titlebar
  
  if (awful.layout.get(c.screen) ==  awful.layout.suit.floating)  
   then
    awful.titlebar.add(c, { modkey = modkey }) 
   end

--{{{ Item added to cause floating:
c:add_signal("property::floating", function(c)  if awful.layout.get(c.screen) ==  awful.layout.suit.floating or awful.client.floating.get(c) 
   then
    awful.titlebar.add(c, { modkey = modkey }) 
   else
    awful.titlebar.remove(c, { modkey = modkey }) 
   end
end)
--}}} 


    -- Enable sloppy focus
    c:add_signal("mouse::enter", function(c)
        if awful.layout.get(c.screen) ~= awful.layout.suit.magnifier
            and awful.client.focus.filter(c) then
            client.focus = c
        end
    end)

    if not startup then
        -- Set the windows at the slave,
        -- i.e. put it at the end of others instead of setting it master.
        -- awful.client.setslave(c)

        -- Put windows in a smart way, only if they does not set an initial position.
        if not c.size_hints.user_position and not c.size_hints.program_position then
            awful.placement.no_overlap(c)
            awful.placement.no_offscreen(c)
        end
    end
end)

This doesn't seem to toggle them either hmm


studio 1558: ubuntu 10.04 awesome wm, gnome, & xmonad ;
ancient frankensteinish desktop computer: arch awesome wm;

Offline

#13 2010-07-28 01:52:53

melanogaster
Member
Registered: 2010-07-22
Posts: 9

Re: Toggling titlebars in awesome

Ohhh wait I just floated a window using <mod><ctrl>space and then upon unfloating it lost it's titlebar. But switching the layout to floating seems to have no effect.


studio 1558: ubuntu 10.04 awesome wm, gnome, & xmonad ;
ancient frankensteinish desktop computer: arch awesome wm;

Offline

#14 2010-07-28 19:57:03

melanogaster
Member
Registered: 2010-07-22
Posts: 9

Re: Toggling titlebars in awesome

Is there some way to use

tag.add_signal("property::layout"...

or something along that line to cause floating for the floating layout?

Last edited by melanogaster (2010-07-28 19:58:08)


studio 1558: ubuntu 10.04 awesome wm, gnome, & xmonad ;
ancient frankensteinish desktop computer: arch awesome wm;

Offline

#15 2010-07-29 00:03:24

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

Re: Toggling titlebars in awesome

Consider this code for the bottom of your rc.lua:

for s = 1, screen.count() do
    for t = 1, #tags[s] do
        tags[s][t]:add_signal("property::layout", function ()
            print("Layout changed on tag: " .. t)
        end)
    end
end

Last edited by anrxc (2010-07-29 00:05:23)


You need to install an RTFM interface.

Offline

#16 2010-07-31 04:32:39

melanogaster
Member
Registered: 2010-07-22
Posts: 9

Re: Toggling titlebars in awesome

Hey thanks anrxc :-). I modified the code you posted to this:

https://docs.google.com/document/edit?i … y=CIWrvtwK

When combined with this in the client.add_signal("manage"... section

c:add_signal("property::floating", function(c)  if awful.client.floating.get(c) 
        then
               awful.titlebar.add(c, { modkey = modkey }) 
        else
               awful.titlebar.remove(c, { modkey = modkey }) 
        end
end)

It does a pretty good job of making sure that floating clients have title bars.
Edit: hmmmm never mind getncol + getnmaster does not appear to equal all the windows on a tag. I guess I need to keep looking through the api or set a high number for the loop like 8.

Last edited by melanogaster (2010-07-31 05:17:07)


studio 1558: ubuntu 10.04 awesome wm, gnome, & xmonad ;
ancient frankensteinish desktop computer: arch awesome wm;

Offline

#17 2016-12-09 02:09:02

montagdude
Member
Registered: 2016-12-09
Posts: 1

Re: Toggling titlebars in awesome

Hi,

I registered because I was searching for a way to do this and came upon this thread. I know this thread is a bit old, but I think it's valuable for posterity's sake to update it since awesome has changed. Hopefully that is okay. Here is how I set up awesome to only show titlebars for floating windows in awesome 3.5.9.

First, make sure titlebars are enabled. There is a variable called titlebars_enabled in the default config in the client "manage" signal code; set it to true:

    titlebars_enabled = true
    -- {{{ Below included for context
    if titlebars_enabled and (c.type == "normal" or c.type == "dialog") then
        -- buttons for the titlebar
        local buttons = awful.util.table.join(
        -- etc. }}}

The next bunch of lines in the config file set up the titlebar. At the bottom of that, add the following modification to hide the titlebar for tiled layouts:

        --{{{  For context
        -- Now bring it all together
        local layout = wibox.layout.align.horizontal()
        layout:set_left(left_layout)
        layout:set_right(right_layout)
        layout:set_middle(middle_layout)

        awful.titlebar(c):set_widget(layout)
        -- }}}

        -- {{{ Mods here
        if (awful.layout.get(c.screen) ~= awful.layout.suit.floating) then
          awful.titlebar.hide(c)
        end
        -- }}}
    end
end)

If you use rc.lua like this, it will show titlebars on new windows only when in a floating layout, but it won't show/hide when the layout is changed. To do that, we need to connect a couple signals. One is the client signal referenced in an earlier post which is emitted when the layout of a single window is changed (e.g., by hitting modkey+Ctrl+space to float/tile a window). The second is a tag signal that is emitted when the layout of the tag is changed and operates on all the clients. Both of them can go at the end of rc.lua as shown below:

-- Note: only works when manually floating/tiling. When changing layout, see tag signal below
client.connect_signal("property::floating", function(c) awful.titlebar.toggle(c) end)

tag.connect_signal(
    'property::layout',
    function(t)
        for _, c in ipairs(t:clients()) do
            if awful.layout.get(mouse.screen) == awful.layout.suit.floating then
                awful.titlebar.show(c)
            else
                awful.titlebar.hide(c)
            end
        end
    end
)

Hopefully this is helpful for someone! IMO this is what makes awesome so ... awesome -- you can really do almost anything with it. Now I have a tiling window manager that also works just as well when I'm just being lazy and using the mouse or when someone more comfortable with the floating paradigm is using my computer (e.g., the wife).

Offline

#18 2016-12-09 02:22:35

WorMzy
Forum Moderator
From: Scotland
Registered: 2010-06-16
Posts: 11,845
Website

Re: Toggling titlebars in awesome

Thanks for sharing, but the bbs really isn't the best place to host this information -- as noted, topics quickly become outdated, and solutions that once worked no longer do. Instead, I recommend that you help update the awesome wiki page (if it needs updating).

Closing.


Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD

Making lemonade from lemons since 2015.

Offline

Board footer

Powered by FluxBB