Centering an Application at Launch

I am trying to center iTerm when it activates.

F13 is a Sizeup keyboard shortcut that actually centers the foremost application.
When hitting F13, the window centers, but when I use alt+tab to activate iTerm, nothing is happening.
Tried with other applications, at iTerm launch, got the same result.

My macro is in the Global Macro Group and enabled.

What am I missing?

Does alt-tabbing to iTerm create a window that gets focus, or does it just activate iTerm in the menubar?

My advice: try KM's built-in window centering action instead (demonstrated with Terminal because I don't have iTerm):

image

1 Like

Alt-tabbing displays the already opened iTerm tab.

Thanks @gglick! It is working now.

But I still do not understand why my macro didn't work. :man_shrugging:

Maybe it needs just a little Pause before the Keystroke action.

Adding a pause action before the key action didn't help.

Every time I use CMD-Tab to activate iTerm, it feels like a letter capital p ("P") is typed or pasted on the newly activated iTerm window. It makes iTerm suggest me the pwd command.

40%20PM

If you are speaking of the program-switcher shortcut, did you mean Cmd-Tab, or did you change the shortcut to Option/Alt-Tab?

In the latter case, I propose to disable the macro/script/hack you are using to change the shortcut and use the normal, unmodified Cmd-Tab and see if the β€œP” still appears.

I am talking about the built-in Mac OS "Cmd-Tab" (sorry for the typo. Fixed it in my previous post).

With this macro, hitting Cmd-Tab, a capital letter "p" is pasted/typed in the active iTerm window.

02%20PM

With this macro, hitting CMD-TAB , a capital letter "p" is pasted/typed in the active iTerm window.
Plus , "sometimes" (= I do not 100% succeed at reproducing the behaviour every time I try) an iTerm notification is displayed with the message "Session ~/Downloads (zsh) #1just rang a bell". (~/Downloads is my current directory in iTerm).

05%20PM

Just tried your first macro and, as expected, I don’t get the β€œP”.

Any other macros activated, that are triggered by the activation of iTerm?
Any macros that could be triggered by Cmd-Tab?

Hey @politicus,

Keyboard Shortcuts are funny things.

When you try to emulate them they don't always work, and there are also potential side effects.

When possible it's always better to have Keyboard Maestro select from an actual menu, although this wouldn't work well with the Sizeup menulet.

-Chris

2 Likes

I tested with all my macros disabled. Still get the "P".

I might have found why it was not working as expected.

  • I set a keyboard shortcut in SizeUp to center iTerm (fn-Ctrl-Alt-Cmd-DownArrow).

  • I set a keyboard shortcut (F13) in Keyboard Maestro to center iTerm

  • I used the keyboard shortcut (F13) I set in Keyboard Maestro to center iTerm when iTerm was activated.

When I use the keyboard shortcut I set in SizeUp all is working well.

Yeah, as @ccstone has said in the post above: