awful: add move and resize mouse bindings

Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Julien Danjou 2008-07-29 16:56:38 +02:00
parent 3db9f29453
commit 1391b3e92b
2 changed files with 9 additions and 4 deletions

View File

@ -324,7 +324,7 @@ function hook_manage(c)
-- Set floating placement to be smart!
c.floating_placement = "smart"
-- Add a titlebar
c.titlebar = awful.titlebar.new({ fg = fg, bg = bg })
c.titlebar = awful.titlebar.new({ fg = fg, bg = bg, modkey = modkey })
awful.titlebar.update(c, bg_normal, fg_normal, bg_focus, fg_focus)
-- Add mouse bindings
c:mouse_add(mouse({ }, 1, function (c) c:focus_set(); c:raise() end))

View File

@ -843,12 +843,17 @@ end
-- @param args Arguments.
-- fg: the foreground color,
-- bg: the background color.
-- text_align: the title text alignment.
-- @return A brand new titlebar.
function P.titlebar.new(args)
local tb = titlebar(args)
local targs = {}
if args.fg then targs.fg = args.fg end
if args.bg then targs.bg = args.bg end
local tb = titlebar(targs)
tb:widget_add(widget({ type = "appicon", name = "appicon", align = "left" }))
tb:widget_add(widget({ type = "textbox", name = "title" }))
local title = widget({ type = "textbox", name = "title", align = "flex" })
title:mouse_add(mouse({ args.modkey }, 1, function (t) t:client_get():mouse_move() end))
title:mouse_add(mouse({ args.modkey }, 3, function (t) t:client_get():mouse_resize() end))
tb:widget_add(title)
local close_button= widget({ type = "textbox", name = "close", align = "right" })
close_button:mouse_add(mouse({ }, 1, function (t) t:client_get():kill() end))
tb:widget_add(close_button)