hs: remove onInit, use onLaunched
This commit is contained in:
parent
8e8708a1c8
commit
d8c5bcc323
|
@ -16,8 +16,10 @@ local function tmuxpresskey(mod, key)
|
|||
return false
|
||||
end
|
||||
|
||||
-- App settings
|
||||
local iterm2
|
||||
App.new("iTerm2")
|
||||
.onInit(function (self, app)
|
||||
.onLaunched(function (self, app)
|
||||
-- cmd+N for switching tmux windows
|
||||
for i = 1,9 do
|
||||
i = tostring(i)
|
||||
|
|
|
@ -28,6 +28,13 @@ App.new = function(name)
|
|||
end
|
||||
self.onLaunched = function(fn)
|
||||
self.onLaunchedFn = fn
|
||||
local app = hs.application.find(self.name)
|
||||
if app then
|
||||
self.launch(app)
|
||||
if app:isFrontmost() then
|
||||
self.activate(app)
|
||||
end
|
||||
end
|
||||
return self
|
||||
end
|
||||
self.onTerminated = function(fn)
|
||||
|
|
Loading…
Reference in a new issue