Keyboard maestro: Defining "if app active" macros
To define Keyboard Maestro macros only active in specific applications you need to define a new Macro Group (left most column in the Keyboard Maestro Editor) and select the application(s) on group level.