Keyboard layout

I HAVE HEBREW KEYBOARD LAYOUT (input source in system preference of the mac)
AND I HAVE ENGLISH KEYBOARD LAYOUT

please
i want to set icon that show on the touch bar:
that show only when HEBREW KEYBOARD LAYOUT is active
and not when ENGLISH KEYBOARD LAYOUT is active

and vice versa
icon that show:
only when ENGLISH KEYBOARD LAYOUT is active
and not when HEBREW KEYBOARD LAYOUT is active

thanks

I'm not sure of a way to do this with Keyboard Maestro, however with Bartender this is easily accomplished.

Bartender lets your arrange and hide your menu bar items, and also allows you to show certain items only when a certain parameter has been met. For instance, I have mine set to show the Dropbox icon only when the icon changes from it's normal state to anything else (like the syncing icon). I have the same for Typinator; when the regular icon is in the menu bar it's hidden, but when expansions are paused and the icon changes, Bartender shows it for me.

So for the keyboard icon, you could have it set to show only when the icon does not match the English keyboard layout icon.

Let me know if you have any more questions about it. Perhaps somebody else knows of a way to do it with Keyboard Maestro or some scripting.

I think you'll find more BTT users in their forums.

As for Bartender, @cdthomer already gave a good alternative. I also use the same approach to display an icon when it changes.