hs: modules/apps clean up
This commit is contained in:
parent
3b54b17d69
commit
8e8708a1c8
|
@ -7,22 +7,17 @@ App.new = function(name)
|
||||||
self.name = name
|
self.name = name
|
||||||
self.bindings = {}
|
self.bindings = {}
|
||||||
|
|
||||||
self.onInitFn = nil
|
|
||||||
self.onActivateFn = nil
|
self.onActivateFn = nil
|
||||||
self.onDeactivateFn = nil
|
self.onDeactivateFn = nil
|
||||||
self.onLaunchedFn = nil
|
self.onLaunchedFn = nil
|
||||||
self.onTerminatedFn = nil
|
self.onTerminatedFn = nil
|
||||||
|
|
||||||
self.bind = function(mods, key, action, predicate)
|
self.bind = function(mods, key, action, predicate)
|
||||||
table.insert(self.bindings,
|
table.insert(self.bindings, {key = hs.hotkey.new(mods, key, action),
|
||||||
{key = hs.hotkey.new(mods, key, action), predicate = predicate})
|
predicate = predicate})
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
self.onInit = function(fn)
|
|
||||||
fn(self)
|
|
||||||
return self
|
|
||||||
end
|
|
||||||
self.onActivate = function(fn)
|
self.onActivate = function(fn)
|
||||||
self.onActivateFn = fn
|
self.onActivateFn = fn
|
||||||
return self
|
return self
|
||||||
|
@ -79,7 +74,7 @@ App.new = function(name)
|
||||||
end
|
end
|
||||||
|
|
||||||
self.clearBinds = function(self)
|
self.clearBinds = function(self)
|
||||||
hs.fnutils.each(self.bindings, function(b) b.key:delete() end)
|
self:disableBinds()
|
||||||
self.bindings = {}
|
self.bindings = {}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue