Add on Remote Login and Remote Disconnect Trigger


I use a hairtail screen (ultrawide) in my home, and I remote login every day from my office.

Because the screen resolution is different, I have to change the resolution every time when remote connecting and then change it back when I get back home.

I was thinking Keyboard Maestro might be able to do the work?

Sorry for the bad English. I hope my grammar is not rude.

Thank you very much for reading this.

Hey @metajs,

Apple doesn't have a native scripting interface for changing screen resolutions, so Keyboard Maestro cannot perform this task in and of itself.

However – there are utilities like SwitchResX available that are AppleScriptable.

And there are a couple of freeware command line utilities:

Since Keyboard Maestro can run AppleScript and shell scripts, it can control these sorts of utilities.


@ccstone Thank you for the information! I"ll try it

But there is no RemoteLogin event. I want know can km want to implement this kind trigger, so we can automate tasks like this.

Doubtful. I'm pretty sure there's no Apple API for notifying on remote log-in.


How are you conducting your remote log-in?

With Apple Screen Sharing?

  • You can monitor for your sharing app and act accordingly.

  • You can create a hotkey triggered macro that looks for certain conditions and acts accordingly.

You may not be able to do exactly what you want, but your available options are still pretty flexible.


One of the existing triggers, like Login or Wake, might be able to detect more or less when you login. Then you just have to detect if you are remote logging in. You could probably do that in a pinch by checking the results of lsof -i -n | grep ESTABLISHED. Something in there will be your remote login connection.

1 Like