Keyboard layout changing hook

I want to change keyboard layout when entering normal mode

hook global ModeChange insert:normal %{
%sh{xkb-switch -s us}
}

This code in kakrc does what I need, but gives an error message:
error running hook ModeChange(insert/normal)/: no such command: ‘’

What am I doing wrong?
Thank you

Hi, when you run a shell block like this you usually want to prepend a nop command to ignore what the shell block produces, something like nop %sh{•••}, the default behavior of hooks and commands in their body definition is too evaluate the body as a sequence of kakoune commands, so the issue you have us most likely due to kakoune trying to interpret whatever your shell block expands to, also andreyorst has a plugin for managing keyboard layouts, GitHub - andreyorst/langmap.kak: Kakoune plugin to toggle between keyboard layouts in insert mode

I realized. Thank you!

This is a nice idea! I wish I had come up with this when switching to colemak. My solution is to change all the keybinds so they fit the new keyboard layout the best.