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
 | 
					  return false
 | 
				
			||||||
end
 | 
					end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					-- App settings
 | 
				
			||||||
 | 
					local iterm2
 | 
				
			||||||
App.new("iTerm2")
 | 
					App.new("iTerm2")
 | 
				
			||||||
   .onInit(function (self, app)
 | 
					   .onLaunched(function (self, app)
 | 
				
			||||||
       -- cmd+N for switching tmux windows
 | 
					       -- cmd+N for switching tmux windows
 | 
				
			||||||
       for i = 1,9 do
 | 
					       for i = 1,9 do
 | 
				
			||||||
         i = tostring(i)
 | 
					         i = tostring(i)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -28,6 +28,13 @@ App.new = function(name)
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
  self.onLaunched = function(fn)
 | 
					  self.onLaunched = function(fn)
 | 
				
			||||||
    self.onLaunchedFn = 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
 | 
					    return self
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
  self.onTerminated = function(fn)
 | 
					  self.onTerminated = function(fn)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue