Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SetWindowsHookEx for Mac OS X?

Windows hooks allows you to poke inside other processes and sometimes alter their behaviors.

Is there such thing for Mac OS X?

Thanks!

like image 976
karlphillip Avatar asked Jul 15 '10 17:07

karlphillip


People also ask

How do I see all open windows on Mac?

Show or move all open windows Show all open windows for the current app: Press Control-Down Arrow. If App Exposé is enabled in Trackpad settings, you can also swipe down with three or four fingers. To return to the desktop, press the keys again or swipe up.

How do I open two windows of the same app on a Mac?

Trying to use the Finder to open multiple instances of an application on Mac OS X will simply cause the first instance to come to the foreground. To get around this, use the open command from the command line with the -n option. The -n option opens a new instance of the application even if one is already running.

How do you hide all windows on a Mac?

Command-H: Hide the windows of the front app. To view the front app but hide all other apps, press Option-Command-H. Command-M: Minimize the front window to the Dock. To minimize all windows of the front app, press Option-Command-M.

How do you switch between applications on a Mac?

Quickly switch between app windows On your Mac, do any of the following: Switch to the previous app: Press Command-Tab. Scroll through all open apps: Press and hold the Command key, press the Tab key, then press the Left or Right arrow key until you get to the app you want. Release the Command key.


1 Answers

SetWindowsHookEx is more like the old InputManager hack, in the sense that you change the code of an app from inside a shared library / a plugin loaded to it.

See SIMBL for a ready-made code injector to another process. For Objective-C classes, you then need to use method swizzling. I haven't tried replacing C functions / C++ classes myself, but surely it can be done using mach_override. See also this blog post.

But usually if you want to modify a GUI app, tapping into Objective-C classes would be sufficient.

like image 69
Yuji Avatar answered Oct 04 '22 09:10

Yuji