diff --git a/hammerspoon/apps/iterm.lua b/hammerspoon/apps/iterm.lua index 00d6437a..7f96457c 100644 --- a/hammerspoon/apps/iterm.lua +++ b/hammerspoon/apps/iterm.lua @@ -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) diff --git a/hammerspoon/modules/apps.lua b/hammerspoon/modules/apps.lua index 906fdae0..2dbb510c 100644 --- a/hammerspoon/modules/apps.lua +++ b/hammerspoon/modules/apps.lua @@ -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)