Skip to content

Instantly share code, notes, and snippets.

@gmdias727
Created November 30, 2024 23:06
Show Gist options
  • Save gmdias727/8b217dcb30d023291674bb08dbb937f4 to your computer and use it in GitHub Desktop.
Save gmdias727/8b217dcb30d023291674bb08dbb937f4 to your computer and use it in GitHub Desktop.
Add this to your .bashrc if you want a toggle function to switch between US and ABNT-2 keyboard layouts on linux.
function toggle_layout {
currentLayout=$(setxkbmap -query | grep layout | awk '{print $2}')
if [ "$currentLayout" == "br" ]; then
setxkbmap us && notify-send -t 1000 "Switched to US Layout"
else
setxkbmap br && notify-send -t 1000 "Switched to ABNT-2 Layout"
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment