tag: Support property fallback

This commit is contained in:
Emmanuel Lepage Vallee 2016-03-13 03:43:50 -04:00
parent a77e650c5f
commit e0897cf170
1 changed files with 11 additions and 0 deletions

View File

@ -11,6 +11,7 @@
local util = require("awful.util") local util = require("awful.util")
local ascreen = require("awful.screen") local ascreen = require("awful.screen")
local beautiful = require("beautiful") local beautiful = require("beautiful")
local object = require("gears.object")
local pairs = pairs local pairs = pairs
local ipairs = ipairs local ipairs = ipairs
local table = table local table = table
@ -873,6 +874,16 @@ function tag.mt:__call(...)
return tag.new(...) return tag.new(...)
end end
-- Extend the luaobject
-- `awful.tag.setproperty` currently handle calling the setter method itself
-- while `awful.tag.getproperty`.
object.properties(capi.tag, {
getter_class = tag,
setter_class = tag,
getter_fallback = tag.getproperty,
setter = tag.setproperty,
})
return setmetatable(tag, tag.mt) return setmetatable(tag, tag.mt)
-- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80 -- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80