- #!/bin/bash
- # By Steven (http://stebalien.com)
- ########################################################################
- # This program is free software: you can redistribute it and/or modify
- # it under the terms of the GNU General Public License as published by
- # the Free Software Foundation, either version 3 of the License, or
- # (at your option) any later version.
- #
- # This program is distributed in the hope that it will be useful,
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- # GNU General Public License for more details.
- #
- # You should have received a copy of the GNU General Public License
- # along with this program. If not, see <http://www.gnu.org/licenses/>.
- ########################################################################
- case "$1" in
- init)
- xmodmap -e 'clear Lock'
- xmodmap -e 'keycode 66 = F13'
- ;;
- navigation)
- echo "Navigation Mode Set"
- xmodmap -e 'keycode 46 = Right'
- xmodmap -e 'keycode 45 = Up'
- xmodmap -e 'keycode 44 = Down'
- xmodmap -e 'keycode 43 = Left'
- ;;
- normal)
- echo "Normal Mode Set"
- xmodmap -e 'keycode 46 = L'
- xmodmap -e 'keycode 45 = K'
- xmodmap -e 'keycode 44 = J'
- xmodmap -e 'keycode 43 = H'
- ;;
- toggle)
- if xmodmap -pk|awk '{ print $1 " " $3 }' | grep '^45 '| grep 'K'; then
- echo "Navigation Mode Auto Set"
- xmodmap -e 'keycode 46 = Right'
- xmodmap -e 'keycode 45 = Up'
- xmodmap -e 'keycode 44 = Down'
- xmodmap -e 'keycode 43 = Left'
- else
- echo "Normal Mode Auto Set"
- xmodmap -e 'keycode 46 = L'
- xmodmap -e 'keycode 45 = K'
- xmodmap -e 'keycode 44 = J'
- xmodmap -e 'keycode 43 = H'
- fi
- esac
- exit 0
