hs: modules/apps clean up

This commit is contained in:
Henrik Lissner 2016-01-07 00:55:50 -05:00
parent 3b54b17d69
commit 8e8708a1c8

View file

@ -7,22 +7,17 @@ App.new = function(name)
self.name = name
self.bindings = {}
self.onInitFn = nil
self.onActivateFn = nil
self.onDeactivateFn = nil
self.onLaunchedFn = nil
self.onTerminatedFn = nil
self.bind = function(mods, key, action, predicate)
table.insert(self.bindings,
{key = hs.hotkey.new(mods, key, action), predicate = predicate})
table.insert(self.bindings, {key = hs.hotkey.new(mods, key, action),
predicate = predicate})
return self
end
self.onInit = function(fn)
fn(self)
return self
end
self.onActivate = function(fn)
self.onActivateFn = fn
return self
@ -79,7 +74,7 @@ App.new = function(name)
end
self.clearBinds = function(self)
hs.fnutils.each(self.bindings, function(b) b.key:delete() end)
self:disableBinds()
self.bindings = {}
end