Keyboard layout and sudo


I’m having trouble with my keyboard layout. My installation is in French and my laptop keyboard is also ISO FR. I have an external keyboard which is ANSI US, and it’s working perfectly fine when I switch to the US layout. But for some reason if I disconnect it and/or switch back to the French layout, my sudo password won’t work when using US keys nor FR keys even when I double-check it in a text editor. My guess is that the terminal doesn’t really follow the keyboard layout that I select.

The workaround that I have right now is to setxkbmap fr and use my laptop keyboard but then I’m unable to change the layout without rebooting.

Is there a way to change that?

I’m using XFCE and have the latest updates.

there is a layout switcher widget for the panel in XFCE4