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