You are not logged in.

#1 2009-05-31 12:31:49

eevo
Member
Registered: 2009-05-31
Posts: 1

Awesome WM: titlebar for floating apps?

Is there any way to add a titlebar just for floating apps?

Offline

#2 2009-05-31 12:49:12

moljac024
Member
From: Serbia
Registered: 2008-01-29
Posts: 2,676

Re: Awesome WM: titlebar for floating apps?

I have nothing to add, I don't use awesome and don't know lua but this is a great idea, one that I've been thinking about lately. I know it should be easily done in Awesome, but some awesome user will have to confirm/show how.

Perhaps something like this could be possible with Xmonad as well... but I don't know haskell either tongue

Damn, I'll learn these two as soon as I get the time...promise! big_smile

Last edited by moljac024 (2009-05-31 12:50:17)


The day Microsoft makes a product that doesn't suck, is the day they make a vacuum cleaner.
--------------------------------------------------------------------------------------------------------------
But if they tell you that I've lost my mind, maybe it's not gone just a little hard to find...

Offline

#3 2009-05-31 13:31:56

andre.ramaciotti
Member
From: Brazil
Registered: 2007-04-06
Posts: 649

Re: Awesome WM: titlebar for floating apps?

I've made a initial hack on this, but it's not perfect. It'll work for apps that are in your floatapps[] at the beginning of rc.lua, but it won't for apps that start in tiling mode and then you send it to float with Ctrl+Mod+Space.

In 'awful.hooks.manage.register', search for this and add the lines marked with a ->:

 -- Check if the application should be floating.
    local cls = c.class
    local inst = c.instance
    if floatapps[cls] then
        awful.client.floating.set(c, floatapps[cls])
   ->   awful.titlebar.add(c, { modkey = modkey })
    elseif floatapps[inst] then
        awful.client.floating.set(c, floatapps[inst])
   ->   awful.titlebar.add(c, { modkey = modkey })
    end

(lambda ())

Offline

#4 2009-05-31 14:00:17

moljac024
Member
From: Serbia
Registered: 2008-01-29
Posts: 2,676

Re: Awesome WM: titlebar for floating apps?

Isn't there a hook that this sort of thing could be done with ?


The day Microsoft makes a product that doesn't suck, is the day they make a vacuum cleaner.
--------------------------------------------------------------------------------------------------------------
But if they tell you that I've lost my mind, maybe it's not gone just a little hard to find...

Offline

#5 2009-05-31 14:48:32

andre.ramaciotti
Member
From: Brazil
Registered: 2007-04-06
Posts: 649

Re: Awesome WM: titlebar for floating apps?

I guess it should be 'awful.hooks.arrange' but I'm not sure how to check if a client is floating. I've tried

awful.hooks.arrange.register(function (screen)
    local layout = awful.layout.getname(awful.layout.get(screen))
    if layout and beautiful["layout_" ..layout] then
        mylayoutbox[screen].image = image(beautiful["layout_" .. layout])
    else
        mylayoutbox[screen].image = nil
    end

    if awful.client.floating.get(client) then
        awful.titlebar.add(client, { modkey = modkey })
    else
        awful.titlebar.remove(client)
    end


    -- Give focus to the latest client in history if no window has focus
    -- or if the current window is a desktop or a dock one.
    if not client.focus then
        local c = awful.client.focus.history.get(screen, 0)
        if c then client.focus = c end
    end
end)

But it didn't work.


(lambda ())

Offline

#6 2009-06-01 16:58:19

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

Re: Awesome WM: titlebar for floating apps?

Great idea,

I can't test this currently but I've found discussion

Maybe it helps you (and maybe you can post how you finally solved it)

Offline

#7 2009-06-02 16:32:02

andre.ramaciotti
Member
From: Brazil
Registered: 2007-04-06
Posts: 649

Re: Awesome WM: titlebar for floating apps?

Thanks Barghest. The last e-mail from this link helps a lot, though it only works with apps that are in "floatapps" (in the beginning of the file). I've made some changes, so it works with any app that is floating, it doesn't matter if the app is in "floatapps" or not.

Add this to the end of the file:

awful.hooks.property.register(function (c, prop)
  -- Remove the titlebar if fullscreen
  if c.fullscreen then
     awful.titlebar.remove(c)
  elseif not c.fullscreen then
    -- Add title bar for floating apps
    if c.titlebar == nil and awful.client.floating.get(c) then
       awful.titlebar.add(c, { modkey = modkey })
    -- Remove title bar, if it's not floating
    elseif c.titlebar and not awful.client.floating.get(c) then
       awful.titlebar.remove(c)
    end
  end
end)

It's not perfect, though. I don't know why, Firefox is always floating, so there's always a titlebar in it. I've tried using 'and c.class ~= 'Firefox'", but then everything stopped working.


(lambda ())

Offline

#8 2009-06-02 20:55:59

jerryluc
Member
From: Norway
Registered: 2008-05-20
Posts: 95

Re: Awesome WM: titlebar for floating apps?

I've been struggling with this for a long time, but never figured it out. Thanks!

Please post if you figure out a perfect hack!!

EDIT: I just notice that this hack work as expected. all floating apps have title bar. btw firefox isn't floating here big_smile

Last edited by jerryluc (2009-06-02 21:26:34)

Offline

#9 2009-06-02 23:36:05

andre.ramaciotti
Member
From: Brazil
Registered: 2007-04-06
Posts: 649

Re: Awesome WM: titlebar for floating apps?

Both Firefox and Epiphany are floating here, I don't know why. And even if I try to make them tile again using modkey+ctrl+space, nothing changes.

Anyway, does anyone here have an account in Awesome's wiki? I think it would be nice to have this little hack there.


(lambda ())

Offline

Board footer

Powered by FluxBB