lib: fix libs to use new awful.button
Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
parent
5e0c84b9fb
commit
21978546eb
|
@ -12,7 +12,7 @@ local type = type
|
|||
local wibox = wibox
|
||||
local image = image
|
||||
local widget = widget
|
||||
local button = button
|
||||
local button = require("awful.button")
|
||||
local capi =
|
||||
{
|
||||
screen = screen,
|
||||
|
@ -176,10 +176,10 @@ local function add_item(data, num, item_info)
|
|||
})
|
||||
|
||||
-- Create bindings
|
||||
local bindings = {
|
||||
local bindings = util.table.join(
|
||||
button({}, 1, function () item_enter(data, num); exec(data, num) end),
|
||||
button({}, 3, function () hide(data) end)
|
||||
}
|
||||
)
|
||||
|
||||
-- Create the item label widget
|
||||
local label = widget({ type = "textbox", align = "left" })
|
||||
|
@ -370,4 +370,4 @@ function new(menu, parent, num)
|
|||
data.toggle = toggle
|
||||
|
||||
return data
|
||||
end
|
||||
end
|
||||
|
|
|
@ -13,9 +13,9 @@ local capi =
|
|||
{
|
||||
wibox = wibox,
|
||||
widget = widget,
|
||||
button = button,
|
||||
client = client,
|
||||
}
|
||||
local button = require("awful.button")
|
||||
local beautiful = require("beautiful")
|
||||
local hooks = require("awful.hooks")
|
||||
local util = require("awful.util")
|
||||
|
@ -63,12 +63,11 @@ function add(c, args)
|
|||
end
|
||||
|
||||
-- Redirect relevant events to the client the titlebar belongs to
|
||||
local bts =
|
||||
{
|
||||
capi.button({ }, 1, function (t) capi.client.focus = t.client t.client:raise() mouse.client.move(t.client) end),
|
||||
capi.button({ args.modkey }, 1, function (t) mouse.client.move(t.client) end),
|
||||
capi.button({ args.modkey }, 3, function (t) mouse.client.resize(t.client) end)
|
||||
}
|
||||
local bts = util.tablejoin(
|
||||
button({ }, 1, function (t) capi.client.focus = t.client t.client:raise() mouse.client.move(t.client) end),
|
||||
button({ args.modkey }, 1, function (t) mouse.client.move(t.client) end),
|
||||
button({ args.modkey }, 3, function (t) mouse.client.resize(t.client) end)
|
||||
)
|
||||
title:buttons(bts)
|
||||
|
||||
local appicon = capi.widget({ type = "imagebox", align = "left" })
|
||||
|
@ -146,12 +145,11 @@ end
|
|||
-- @param theme The theme from beautifull. Used to get the image paths
|
||||
-- @param state The state the button is associated to. Containse path the action and info about the image
|
||||
local function button_new(c, name, modkey, theme, state)
|
||||
local bts =
|
||||
{
|
||||
capi.button({ }, 1, nil, state.action),
|
||||
capi.button({ modkey }, 1, function (t) mouse.client.move(t.client) end),
|
||||
capi.button({ modkey }, 3, function (t) mouse.client.resize(t.client) end)
|
||||
}
|
||||
local bts = util.table.join(
|
||||
button({ }, 1, nil, state.action),
|
||||
button({ modkey }, 1, function (t) mouse.client.move(t.client) end),
|
||||
button({ modkey }, 3, function (t) mouse.client.resize(t.client) end)
|
||||
)
|
||||
|
||||
-- get the image path from the theme. Only return a button if we find an image
|
||||
local img
|
||||
|
|
|
@ -6,10 +6,10 @@
|
|||
|
||||
local setmetatable = setmetatable
|
||||
local type = type
|
||||
local button = require("awful.button")
|
||||
local capi = { image = image,
|
||||
widget = widget,
|
||||
mouse = mouse,
|
||||
button = button }
|
||||
mouse = mouse }
|
||||
|
||||
module("awful.widget.button")
|
||||
|
||||
|
@ -32,7 +32,7 @@ function new(_, args)
|
|||
args.type = "imagebox"
|
||||
local w = capi.widget(args)
|
||||
w.image = img_release
|
||||
w:buttons({ capi.button({}, 1, function () w.image = img_press end, function () w.image = img_release end) })
|
||||
w:buttons(button({}, 1, function () w.image = img_press end, function () w.image = img_release end))
|
||||
function w.mouse_leave(s) w.image = img_release end
|
||||
function w.mouse_enter(s) if capi.mouse.coords().buttons[1] then w.image = img_press end end
|
||||
return w
|
||||
|
|
|
@ -5,9 +5,9 @@
|
|||
---------------------------------------------------------------------------
|
||||
|
||||
local setmetatable = setmetatable
|
||||
local capi = { button = button }
|
||||
local util = require("awful.util")
|
||||
local button = require("awful.widget.button")
|
||||
local wbutton = require("awful.widget.button")
|
||||
local button = require("awful.button")
|
||||
|
||||
module("awful.widget.launcher")
|
||||
|
||||
|
@ -17,14 +17,13 @@ module("awful.widget.launcher")
|
|||
-- @return A launcher widget.
|
||||
local function new(_, args)
|
||||
if not args.command and not args.menu then return end
|
||||
local w = button(args)
|
||||
local w = wbutton(args)
|
||||
if not w then return end
|
||||
local b = w:buttons()
|
||||
|
||||
if args.command then
|
||||
b[#b + 1] = capi.button({}, 1, nil, function () util.spawn(args.command) end)
|
||||
b = util.table.join(w:buttons(), button({}, 1, nil, function () util.spawn(args.command) end))
|
||||
elseif args.menu then
|
||||
b[#b + 1] = capi.button({}, 1, nil, function () args.menu:toggle() end)
|
||||
b = util.table.join(w:buttons(), button({}, 1, nil, function () args.menu:toggle() end))
|
||||
end
|
||||
|
||||
w:buttons(b)
|
||||
|
|
|
@ -14,7 +14,8 @@ local tostring = tostring
|
|||
local hooks = require("awful.hooks")
|
||||
local string = string
|
||||
local widget = widget
|
||||
local button = button
|
||||
local button = require("awful.button")
|
||||
local util = require("awful.util")
|
||||
local capi = { screen = screen }
|
||||
local bt = require("beautiful")
|
||||
local screen = screen
|
||||
|
@ -328,8 +329,7 @@ function notify(args)
|
|||
|
||||
-- create textbox
|
||||
local textbox = widget({ type = "textbox", align = "flex" })
|
||||
textbox:buttons({ button({ }, 1, run),
|
||||
button({ }, 3, die) })
|
||||
textbox:buttons(util.table.join(button({ }, 1, run), button({ }, 3, die)))
|
||||
textbox:margin({ right = config.margin, left = config.margin })
|
||||
textbox.text = string.format('<span font_desc="%s"><b>%s</b>%s</span>', font, title, text)
|
||||
if hover_timeout then textbox.mouse_enter = hover_destroy end
|
||||
|
@ -345,7 +345,7 @@ function notify(args)
|
|||
-- if we have an icon, use it
|
||||
if icon then
|
||||
iconbox = widget({ type = "imagebox", align = "left" })
|
||||
iconbox:buttons({ button({ }, 1, run), button({ }, 3, die) })
|
||||
iconbox:buttons(util.join(button({ }, 1, run), button({ }, 3, die)))
|
||||
local img
|
||||
if type(icon) == "string" then
|
||||
img = image(icon)
|
||||
|
|
Loading…
Reference in New Issue