Comment 2 by pe...@morth.org on December 06, 2010 18:39
I made a somewhat quick and dirty event tap, last commit here: https://code.launchpad.net/~pelle-morth/iterm/iterm2-command-meta-key/
Incidently requires my previous code (the rest of the branch) :)
Not really super proud of the code, probably requires at least some configuration, but it does work. Can be used for inspiration at least.
Comment 3 by geor...@google.com on December 06, 2010 18:54
Wow, you did all the work! Thanks, pelle! I'm in the midst of a really big change at the moment and I don't want to make it any bigger but I will look at integrating this when I'm finished in about a week.
Comment 6 by jyrki.pulliai... on January 24, 2011 17:22
What's the situation of this bug? The change is available in pelle's branch, but that is an old branch otherwise. Do you have any plans on integrating this functionality?
Comment 9 by pe...@morth.org on January 28, 2011 23:43
r508 kinda fixed it, but it has no option to choose left command key as +ESC and right command key as normal, which is what I'm currently using (with my patch). I could open a new bug for that though.
Shouldn't the event tap be returning eventCopy if iTerm is the frontmost application? Right now system shortcuts like command-tab are not bypassed.
Comment 10 by geor...@google.com on January 28, 2011 23:52
Ah, missed that your patch split out left from right command key. Will reopen this bug to fix that. We perform the remapping in -[iTermApplicaiton sendEvent:] rather than in the event tap since the event tap is not always installed. I guess I should try to install the event tap, and fall back to the current plan if it fails.
Comment 14 by pe...@morth.org on January 29, 2011 10:03
I believe it is. If you have a breakpoint in there with commands bt ; c (don't actually stop in there as you can't use your keyboard/mouse) you'll see that you're in a callback from your runloop, just like sendEvent is. The only issue is that the system is waiting for your event tap to complete, so probably not a good idea to start any lengthy operations there.
But if it's only done for the event that will turn out to be the meta key then I suppose it shouldn't be an issue.
Another thing I just thought of is if you set eg. left option to work as command should option-tab activate the process switching? In that case the modified event has to be returned from the event tap.
It would be strange indeed for option-tab to take you out of iTerm2 but cmd-tab to take you in; but if you want to switch modifiers globally, there is already a UI for that in system prefs. So I guess the right thing is to return the modified event from the event tap.