Toggle key us/ru

From Krayon, 3 Years ago, written in Bash, viewed 169 times. This paste is a reply to from - view diff
URL https://p.qdnx.org/view/f0d6a913 Embed
Download Paste or View Raw
  1. #!/bin/bash
  2.  
  3. [ "${1}" == "-u" ] && setxkbmap us && exit 0
  4. [ "${1}" == "-r" ] && setxkbmap ru && exit 0
  5.  
  6. # Assume toggle
  7.  
  8. cur="$(setxkbmap -query|grep layout:|awk '{print $2}')"
  9.  
  10. [ "${cur}" == "ru" ] && setxkbmap us && exit 0
  11. [ "${cur}" == "us" ] && setxkbmap ru && exit 0
  12.  
  13. # vim:ts=4:tw=80:sw=4:et:ai:si

Reply to "Toggle key us/ru"

Here you can reply to the paste above