1

I'd like to start two Terminals and put them at specific positions on my screen. I know how to do this with one Terminal but what do I have to do to open a second Terminal and position it next to the first one?

Here is the code for one Terminal:

hs.hotkey.bind({"cmd", "alt", "ctrl"}, "2", function()
  hs.application.launchOrFocus("Terminal")
  local win = hs.window.focusedWindow()
  local f = win:frame()
  local screen = win:screen()
  local max = screen:frame()

  f.x = max.x
  f.y = max.y

  f.w = 960
  f.h = 540
  win:setFrame(f)
end)
wintermeyer
  • 8,178
  • 8
  • 39
  • 85

1 Answers1

1

So this potentially gets quite complex, but what I would do is have the hotkey check to see if Terminal is already running. If not, launch it and put it in position 1. If it is already running, focus it, activate the menu item to open a new window, and put it in position 2.

Chris Jones
  • 456
  • 2
  • 8