diff --git a/lib/awful/widget/clienticon.lua b/lib/awful/widget/clienticon.lua index 69d8aa237..98e87dc4e 100644 --- a/lib/awful/widget/clienticon.lua +++ b/lib/awful/widget/clienticon.lua @@ -31,7 +31,7 @@ end function clienticon:draw(_, cr, width, height) local c = self._private.client - if not c.valid then + if not c or not c.valid then return end @@ -52,7 +52,7 @@ end function clienticon:fit(_, width, height) local c = self._private.client - if not c.valid then + if not c or not c.valid then return 0, 0 end @@ -80,6 +80,22 @@ function clienticon:fit(_, width, height) return w * aspect, h * aspect end +--- The widget's @{client}. +-- +-- @property client +-- @param client + +function clienticon:get_client() + return self._private.client +end + +function clienticon:set_client(c) + if self._private.client == c then return end + self._private.client = c + self:emit_signal("widget::layout_changed") + self:emit_signal("widget::redraw_needed") +end + --- Returns a new clienticon. -- @tparam client c The client whose icon should be displayed. -- @treturn widget A new `widget`