From 4ac6d4568b79678a3bcd44705d1eea33e1a508e2 Mon Sep 17 00:00:00 2001 From: Julien Danjou Date: Wed, 3 Sep 2008 21:12:10 +0200 Subject: [PATCH] awful: create a new launcher widget Signed-off-by: Julien Danjou --- lib/awful.lua.in | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/lib/awful.lua.in b/lib/awful.lua.in index 76c05eec..eae7b633 100644 --- a/lib/awful.lua.in +++ b/lib/awful.lua.in @@ -1600,6 +1600,19 @@ function widget.button(args) return w end +--- Create a button widget which will launch a command. +-- @param args Standard widget table arguments, plus image for the image path +-- and command for the command to run on click. +-- @return A launcher widget. +function widget.launcher(args) + if not args.command then return end + local w = widget.button(args) + local b = w:buttons() + b[#b + 1] = capi.button({}, 1, nil, function () spawn(args.command) end) + w:buttons(b) + return w +end + --- Check if an area intersect another area. -- @param a The area. -- @param b The other area.