Show/hide hotkey uses raw keyboard keys, ignores keyboard layout
By w...@wisq.net on October 15, 2011 16:10 (imported from Google Code)
The iTerm show/hide key does not respect keyboard layouts. When set, it attaches to a raw keyboard key — even though it appears to attach to a translated (mapped) key in the current layout. This causes problems when switching between keyboard layouts, or if using a device that remaps keyboards at the hardware level (even if I'm pressing the same logical key).
Steps to reproduce:
- In System Preferences, select a keyboard layout — let's say Dvorak.
- Set your iTerm show/hide key to some key — let's use command-(key next to tab).
- iTerm will display the key you chose in the current keyboard layout. Using the above examples, it would now show "⌘'" (command-apostrophe).
- Change keyboard layouts — let's go back to Qwerty.
- Bring up the iTerm preferences. Notice that it still displays the key you chose.
- Attempt to bring up iTerm using the displayed (logical) key. With the above examples, that would be command-apostrophe (key next to enter) in Qwerty. (Nothing happens.)
- Attempt to bring up iTerm using the same keyboard (physical) key you set it up with. With the above examples, that would be command-(key next to tab), i.e. command-Q. (It works.)
- Set your iTerm show/hide key to the same physical key. Notice how the displayed logical key changes, even though you're not actually changing the physical show/hide key. With the above examples, it would now display "⌘Q" instead of "⌘'", but nothing has really changed.
(FYI: "a" and "m" are the same in Dvorak and Qwerty, so if you want to test with different keys, don't use those two.)
Given that the iTerm preferences say that my key is set to <X>, I would expect that pressing the logical key <X>, in any layout, would be the trigger key. Instead, it really means "the physical key that maps to logical key <X> when your keyboard layout is set to the same layout as when you set this setting". Not entirely intuitive. :)
Running iTerm2 18.104.22.16810909 on OSX 10.6.8 Snow Leopard.
The full, long story:
I use Dvorak as my main keyboard layout. Usually, I run with a normal keyboard (e.g. the built-in Macbook keyboard) with Dvorak as my software keyboard layout (in System Preferences) — let's call this "software remapped".
Sometimes, I use a hardware device that remaps Qwerty to Dvorak at the hardware level. I type in Dvorak, but the computer sees me typing the same letters in Qwerty instead, and I set my software keyboard layout to Qwerty — call this "hardware remapped".
(This is useful for games, which often also bind to raw keyboard keys. Or for pair programming, where we want two USB keyboards, one in each layout. Or for attaching to a KVM switch that includes a hardware remapper. All of which are common scenarios for me.)
In software remapped mode, my global iTerm show/hide key is command-apostrophe (⌘'), where apostrophe is the key next to "tab". This works fine so long as I continue to use software-remapped mode.
If I switch to Qwerty (with no remapping), the keyboard layout changes, but the iTerm activation key remains the same. It's now command-Q (key next to tab), which shadows the existing Mac "quit" key. However, iTerm still shows it as "⌘'", ignoring the fact that it's really "⌘Q" now.
If I then enable hardware remapping, the raw keyboard keys change, meaning that I now have to actually enter command-Q in Dvorak rather than command-apostrophe. (That's like pressing command-X on Qwerty.)
Obviously, this makes it rather difficult to switch between the two remapping methods as needed, even though I'm essentially pressing the same key (command-apostrophe) at all times.
(You can probably imagine the looks I get when I tell my pair programmer that they should bring up the terminal using command-Q.)
I don't know if binding to a raw keyboard key is a fundamental limitation of being able to have a global show/hide key, but it's certainly confusing behaviour. Also, I'm guessing some users may prefer that the key not change based on keyboard layout, so if this is "fixed", it should probably be a toggle option.