OSX 10.9.5 - different keyboard layouts per application
I use the keyboard switching as well.
To do that I just click on the menu bar Input source name Icon and select the keyboard I need.
That assumes you set the Input Sources in your sys pref key board, and you can choose the Automatically switch to documents input source as well if you prefer.
Auto switch:
Choose an input source for a document and have it used every time you work in the document until you close it, even if you switch to other documents that use other input sources in the meantime.
This option appears only when you add a second input source.
If you're using Keyboard Maestro for this, use the action called "Set keyboard layout to" instead of the applescript. It instantly changes the layout without pulling down the menu.
As @LeeJoramo suggested, you can use Keyboard Maestro and some AppleScript to turn on the desired layout when switching to a certain app. For example, here's a KM macro that sets my keyboard layout to "Greek" when I switch to TextMate:
The script, borrowed from this StackOverflow answer:
tell application "System Events" to tell process "SystemUIServer"
tell (menu bar item 1 of menu bar 1 whose description is "text input")
select
tell menu 1
click (first menu item whose title contains "Greek")
end tell
end tell
end tell
There is an app which is aupposed to be able to do this, but I have not tried it mayself: AutoKeyboard
http://www.macupdate.com/app/mac/51829/autokeyboard