From 0cb3569e3eb4255cd801ddae0e04b1e1d5d5d3c9 Mon Sep 17 00:00:00 2001 From: Uli Schlachter Date: Wed, 6 Oct 2010 14:30:00 +0200 Subject: [PATCH] awful.widget.layoutbox: Port to new widget system Signed-off-by: Uli Schlachter --- lib/awful/widget/layoutbox.lua.in | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/lib/awful/widget/layoutbox.lua.in b/lib/awful/widget/layoutbox.lua.in index f0eda695..d5b2c438 100644 --- a/lib/awful/widget/layoutbox.lua.in +++ b/lib/awful/widget/layoutbox.lua.in @@ -10,31 +10,24 @@ local button = require("awful.button") local layout = require("awful.layout") local tag = require("awful.tag") local beautiful = require("beautiful") -local capi = { oocairo = oocairo, - widget = widget } +local imagebox = require("wibox.widget.imagebox") +local capi = { oocairo = oocairo } --- Layoutbox widget. module("awful.widget.layoutbox") local function update(w, screen) local layout = layout.getname(layout.get(screen)) - if layout and beautiful["layout_" ..layout] then - w.image = capi.oocairo.image_surface_create_from_png(beautiful["layout_" ..layout]) - else - w.image = nil - end + w:set_image(layout and beautiful["layout_" .. layout]) end --- Create a layoutbox widget. It draws a picture with the current layout -- symbol of the current tag. -- @param screen The screen number that the layout will be represented for. --- @param args Standard arguments for an imagebox widget. -- @return An imagebox widget configured as a layoutbox. -function new(screen, args) +function new(screen) local screen = screen or 1 - local args = args or {} - args.type = "imagebox" - local w = capi.widget(args) + local w = imagebox() update(w, screen) local function update_on_tag_selection(tag)