53

Under Preferences -> 'Keys' It is possible to tick Show/hide iTerm2 with a system-wide hotkey.

However iTerm always appears on the main display (monitor) instead of where the cursor currently resides.

e.g. if I have three monitors, and am working on the third screen, the hotkey makes iTerm appear on first monitor, instead of where I am currently working.

Any advice how to solve this please?

UPDATE:

The bug strikes back again in v.3.1.6. If any workarounds are known, please share.

Houman
  • 64,245
  • 87
  • 278
  • 460
  • Funny, how other iTerm2 questions aren't voted to be closed. http://stackoverflow.com/questions/6205157/iterm2-how-to-get-jump-to-beginning-end-of-line-in-bash-shell – Houman Mar 27 '15 at 10:48
  • Create a new `Space`, right click on the iTerm2 icon in the dock, then assign it to whatever display... – l'L'l Mar 27 '15 at 11:42
  • Thanks, not sure if I understood you. It isn't about `space`. I have three monitors connected to the laptop. iTerm2 should appear on the desktop where I press the hotkey. Currently it always appears on the same desktop, no matter where I am working. – Houman Mar 27 '15 at 14:51
  • I'm not talking about `space`, but rather creating one so your app does what you want it to. I'm surprised that you run three displays and don't know about [Spaces](http://en.wikipedia.org/wiki/Spaces_%28software%29)? The functionality is built into [Mission Control](http://en.wikipedia.org/wiki/Mission_Control_%28OS_X%29), and gives you ability to decide where and how apps appear on your displays (virtual or real). – l'L'l Mar 27 '15 at 16:00
  • I don't understand either what @l'L'l is is suggesting. Houman did you managed to get the desired behaviour because I have the same problem. Would be great if you could explain how to do it if you understand it. – sarunast Nov 09 '15 at 12:29
  • No @Stamy, I eventually gave up on iTerm2 and am using TotalTerminal instead. – Houman Nov 09 '15 at 23:07
  • 1
    I like this functionality so much, with el capitan they added extra security so in order to use TotalTerminal I have to disable it. To make things even more TotalTerminal stopped development and recommends to use iTerm2. So if you manage to find a solution later, please do share. – sarunast Nov 10 '15 at 08:58
  • 4
    Sure will do. What a shame. Nothing beats `Guake`. A shame Mac doesn't have it. – Houman Nov 10 '15 at 10:13
  • 1
    @Houman I'm using iterm2.9. It seems this version has solved the problem already. – sel-fish Apr 19 '16 at 11:10
  • @sel-fish can you direct me how exactly? I notice this option to "screen: screen with cursor" in profiles -> window but it doesn't seem to affect. Is there another setting option that I'm missing? Thanks! – Boaz Rymland Apr 19 '16 at 21:07
  • @BoazRymland, I'm not sure because I didn't mean to change any setting related to that. I think I should describe my actions, first, I set 'Show/hide iTerm2 with a system-wide hotkey'; then, press that hot-key, the iTerm2 window hides; then, move my cursor to another screen; then press the hot-key, the iTerms windows appears on the screen where cursor stays. Is that action what you want ? – sel-fish Apr 25 '16 at 00:26
  • 1
    @sel-fish that's exactly what I am looking for however with me the terminal stays on the same screen after showing / hiding. Could you tell me what settings you are using to make this work? – Fraak Jun 14 '16 at 12:57
  • @Fraak I haven't used this feature for days. After received your comment, I test again and find it doesn't work anymore.. I will find the solution and answer the question later :) – sel-fish Jun 14 '16 at 23:36
  • After (finally) getting around to upgrading to El Capitan, and switching to iTerm 2 as a consequence, I too am noticing this odd behaviour. – Landak Jul 21 '16 at 08:52
  • tried to add some log to solve but failed for now :( https://github.com/sel-fish/iTerm2 – sel-fish Jul 21 '16 at 09:16
  • What do you have "Space" set to in the "Window" tab in iTerm2 settings? – finbarr Feb 27 '17 at 17:58
  • [Grant's answer](https://stackoverflow.com/a/43382153/6314615) works, but you have to restart iTerm. – levelont Jun 22 '17 at 11:40
  • 2
    it seems the issue is back on 3.3.7 when using on mac os catalina – ierdna Dec 25 '19 at 16:53
  • @ierdna the bug is back for a long time. Sadly no fix in sight. – Houman Dec 26 '19 at 11:11
  • There's a bug report in iterm's gitlab account: https://gitlab.com/gnachman/iterm2/issues/8536 – ierdna Dec 26 '19 at 12:07

5 Answers5

54

I'm on Sierra using iTerm 3.1 and I have the option under window to put the screen where the cursor is (bottom right drop down options). I'm using it with a hotkey.

iTerm preferences

Grant
  • 1,822
  • 1
  • 21
  • 30
  • @Houman Strange that it works for me then... Guess I'm special – Grant May 20 '17 at 12:33
  • 1
    use the beta version, it will work. https://iterm2.com/downloads/beta/iTerm2-3_1_beta_4.zip – Harry May 29 '17 at 05:18
  • 11
    It's working when opening a **new** window. When a window was previously opened, it'll not **move** to the active screen – Highmastdon Aug 02 '17 at 09:15
  • For me this is working for creating the window but when using it the second time it opens on my primary screen (the MBP). – E. Sundin Oct 24 '17 at 17:31
  • It worked for me for my "Visor" window on Mojave `10.14.3` and iTerm `3.2.8`. – Nicolas Gramlich Apr 23 '19 at 17:44
  • 2
    For those using the *'Hotkey'* to open the iTerm just like Guake or Yakuake, make sure you enable this config for the profile called *'Hotkey Window'*, that made the trick for me. – Jorge Palacio Feb 12 '20 at 21:26
  • its 2020 and its not working for me... neither for the hotkey or when i quit iterm and start a new window. Does this require system restart or something? – Xitcod13 Jul 24 '20 at 19:05
9

The answer by Grant works. The only thing you need to do is to install the beta version since there was a bug in the stable version.

This bug was fixed in 3.1.beta.1 https://iterm2.com/downloads.html enter image description here

Here's the link to the latest beta version https://iterm2.com/downloads/beta/iTerm2-3_1_beta_4.zip

Harry
  • 1,572
  • 2
  • 17
  • 31
5

This may be a couple more keystrokes than you were hoping for, but if you install window management software like Size Up, you can get this working with just a few keystrokes.

Maintain your ⌥Space hotkey preference on Iterm2. Go to Size Up -> Preferences and change 'Send Window Prev Monitor' to an easy keystroke. I used ⌥1.

Now, you can do ⌥Space to get the terminal open and ⌥1 one or two times to get it to your monitor of choice. It takes a couple of key combos, but not too many!

Julie
  • 1,941
  • 3
  • 17
  • 30
  • 8
    The trouble with this method is that I don't feel it actually matches what the app itself should do -- to my mind a picture of a drop-down menu in preferences saying _"Screen with cursor"_ should make the hotkey window do _exactly that_: appear on the screen with the visor. – Landak Jul 28 '16 at 08:57
0

I had this problem with macos monterey and iterm 3.4.15. I'm using the hotkey to show the terminal with slide-out window. After some search on the internet I found that disabling the option on system preferences to reopen closed documents solved the issue and the hotkey is now opening terminal on the screen with cursor as it should.

mac -> System preferences -> General -> (deselect this) Close windows when quitting an app

  • Your using a character that is not rendering on most machines "". You might want to consider finding a UTF-8 equivalent. – ouflak Feb 21 '22 at 18:43
0

Neither of the above worked for me, but this helped, even though the question was quite different in that thread.

tony
  • 1,506
  • 3
  • 21
  • 28